Adventures with XRB gambling bots, scripting Raigames.io (warning they might misrepresent the odds, BE CAREFUL!)
A few weeks ago I decided to play around with a site at https://raigames.io that has a very cool social gambling game that they advertise as 99% luck, 1% skill. One of the interesting properties of the game is that it is a multiplayer game that is theoretically beatable if you are able to out play the other players. Furthermore, there is a built in scripting interface where you can write javascript code to automate a bot that plays the game 24/7.
The way the game works is simple. There is a hidden random number that their server generates that is greater than 1 and rounded to the nearest 0.01. A counter starts counting up from one until it reaches that hidden number at which point there is a "crash". Players can cash out any time before the crash and they will get the value of the counter at the time they cashed out times their bet amount. If the "crash" occurs before they cash out, then they lose their bet amount.
So for example, if the servers hidden number is 1.9, if you bet 100 and cash out at 1.8, you get 80 chips in profit. If you try to wait to cash out until 2.0 to double your money it will crash at 1.9 and you'll lose your 100 chips. The odds are set such that the house has an edge ranging between 0% and 1% that increases the longer that you wait to cash out.
What makes it interesting is that they (effectively) take 1% of all the bets and put them in a "bonus pool" that goes to the people who cash out the latest. Thus, in theory if you on average were to win a 2% bonus, that would cover your own 1% contribution to the bonus pool and the maximum 1% house edge, and anything beyond that would be a profit.
So I set about making a javascript bot that could effectively "snipe" the bonus by cashing out at the earliest time when the bonus was guaranteed. It tracked its own bonus results and its own cashouts to determine the house edge that was paying. Finally, it would also exploit mistakes in other bots in some complex ways. Over its last 30K games, it weighted average results had it earning slightly over 2% of the bonus which, based on the house edge it faced on average should have been a solid 0.5% plus return per bet.
However, despite betting a large amount over a huge sample where I let it run 24/7 for over a week, my bot was break even. All the results are public and viewable here: https://raigames.io/user/joedimago
As a poker player, one piece of advice I've always lived by, is if you feel like you are getting scammed, stop playing immediately and figure out what is going on. So that is what I did. It took me a while to figure out what could possibly be going on, but I believe that I have a possible explanation. Note that I am not saying that this is 100% definitively the case, but my current suspicion based on what I know is that while the site is accurately and fairly generating random "crash" values, because of the way the site implements the game around those crash values, I believe that the odds are worse than they state. This is just my personal opinion based on my experience, if the developers can prove me wrong, I'm open to being convinced.
Evidence
At https://raigames.io/ they describe in depth how the game is "provably" fair. Basically they seeded an RNG with a hash from a bitcoin block that had not been mined when they launched the site. The even link to a JS fiddle that lets a third party pull crash values: https://jsfiddle.net/1L1uqcgv/6/embedded/result/. You can also do statistical analysis on the historical crash values and while I haven't investigated this 100% in depth, but my belief is that they are fair as described.
The odds of a crash value C being chosen are 100/101 * 1/((C - 0.01)/0.99). The 100/101 is actually what they use to seed the bonus pool. If you plug in 2 for C you will get a 0.49256181899 chance of hitting a crash value of 2, which in theory would let you double your money. This exactly matches their odds calculator here: https://raigames.io/calculator.
They then go on to describe the house edge in this case by saying that your expected value if you bet 100 and try to cash out at 2.0 is
0.49256181899 * 100 + (1 - 0.49256181899) * - 100 = -1.487636202
In theory, of that lost EV, 1/101 * 100 of it went to the bonus pool and the rest went to the house.
This means that the hose edge in this case should be
(0.49256181899 * 100 + (1-0.49256181899) * -100) + 100 * 1/101 = 0.497537190905021%
Again this EXACTLY matches their odds calculator. Furthermore, I went back and historically analyzed the % of games where the "crash" value is 2.0 or greater and it matches these numbers very closely.
So how could my bot not be winning? After double checking all my code to convince myself that my bot was not incorrectly logging its results, I figured out what I believe to be the answer.
The way the game works, when a "crash" value of 2.00 is chosen, the game "crashes" at what appears to be the instant 2.00 is reached. You cannot manually cash out at 2.00 when the crash value is 2.00, the latest you can possible cash at is at 1.99. This means that you are systematically getting 0.01 less of a multiplier on your winnings than the odds might suggest.
The simplest evidence for this is to notice that if you imagine trying to cash out instantly at 1.0, their odds say that there is absolutely no house edge in this case. Here is a screen shot of this from their own odds calculator:
The odds of you succeeding they list as 1-1/101. The 1/101 is what they call a crash at "0" and all of that money goes into the bonus pool, none goes to the house. So you should be 100% guaranteed that if you try and cash out at 1.00 that unless there is a "0" crash that goes into the bonus pool that you will succeed.
Crash values of 1.00 do appear as shown here: https://raigames.io/game/10797108
In reality it is entirely possible to try and cash out at 1.00 and to fail and have a crash at least if you manually click the cash out button or have your bot dynamically attempt to cash out. It is possible that if you use the "automatic cashout" at a preset value when you choose your bet that you do get the odds that the game claims, but I believe that when you trigger a cashout mid game
Conclusion
This is all just may opinion and may be wrong, but it is my best guess as to what is going on based on my experience and the data from my bot over 50K rounds of play. Raigames.io is fun and I like the game, but I personally have stopped playing there because I am not confident that the odds that the site lists reflect the odds the you actually get as a player. If anyone has proof that I am wrong I'd love to hear it and maybe I'll turn my bot back on and have it bet tiny amount for a few thousand more rounds to see if maybe I just got very very unlucky.
I have no stake in raigames.io or any of their competitors and this information is just my personal thoughts for entertainment value.
I don't know like gambling and such things.But i read your whole article.I love the way you explain each and every rule of game :)
Thanks! Glad you liked it.
Upvoted as well.
Thanks for your analysis.
I was about to try their game and was wondering what programming language you used for your bot.
They have a built in javascript engine, select "Auto" and then in the bottom right there is a dropdown that you can set to custom. See highlighted red rectangle in screen shot.
Ok, i see.
I was thinking about a bot looking as well at some stats of previous rounds + the participants of the round (you exit ony when first bonus is there, size of the bonus based on previous round, etc).
you can make your bot track all of those things while it plays and put it in local storage. that is what mine did.