graywolf336 / CasinoSlots

Animated, customizable, block-based slot machines, including audio, inside of Minecraft!
http://dev.bukkit.org/server-mods/casino-slots/
GNU General Public License v2.0
23 stars 24 forks source link

Rewards chance -really low, really hard to calculate. #30

Closed stgram closed 8 years ago

stgram commented 11 years ago

Hi, you got a really awesome plugin there! But, I like math. And this causes me some trouble... :/ When I create slots, I want to know exactly how often is the player going to win 300$ for example, or the grand prize, or just a stack of melons. Your plugin relies on getting 3 in a row/diagonal. If we focus on the middle row for a sec: Lets say in the config we have 20 blocks obsidian, 30 sand and 50 stone. When you roll, you pick a random number from 0 to 99, picking the block. So the chance for an obsidian in the first column is 20/100 = 20%. But, to score a double obsidian, we need to square that. For a winning row, the chance is (20/100)^3=0.8% Ok, this could be the jackpot, but what about the others? The stone gets to 12.5%, and the sand is in the middle. All we are left with is somewhere about 8/10 attempts that win nothing. And if I add more items, like 5 or 6 different winning blocks, the rate of loss rises to 95% and more! So, that is like, play 20, win one. Pretty dull for the player, right? The jackpot I guess should be somewhere about 100 000, to look nice for the players? (if you want, I will create you a google excel sheet, so you can see how exactly the calculations go.) But, then again, you can win by 5 different rows here. So that makes 5x the winning rate? Not really, since you got that neat little line of code that omits duplicates, and this is where I got lost in my math. You see, some times you win, some times you lose, but you cant really control what and when? That actually represents a real slot, good job. But too bad that our minecraft players aren't drunk rich kids (maybe just kids) who are willing to spend a fortune there. What I am proposing, is a new system for "calculating" wins. In the config, instead of number of blocks, add a variable between 0 and 0,4. Lets say, I add one block with a chance of 20%, one block with 12%, another with 8%, and the big prize, maybe 2%? The rest 58% are going to be empty, e.g. not matching rows. Those are my thoughts for now, but I will try to come up with more ideas. So far, what is your opinion?

stgram commented 11 years ago

On a second thought, I think I got the hang of creating good coefficients. The diagonal win rule is tricky. Actually, those lines that omit duplicated blocks dont change a lot, I wrote a program just to test that, after 10 million checks, the difference is not that big. So far, I've created 2-3 reasonable slots, on excel my setup shows everything, money spent, money lost, chance for the big prize, chance to die, and so on. As I am still working on it, I will send you at some point a working copy, it could be useful for the others to know what slots are they dealing with. (Well, not for the players of course, they dont need to know the magic. :3

graywolf336 commented 11 years ago

I would be interested in seeing what it is you came up with. This is something that I too have struggled with when I was creating the slots on my server and wanted to come up with something different but couldn't at the time (wasn't as good in coding as I've become now).

I'll think over and try to come up with something, no promises that it will happen any time soon as I'm currently working on a side project that is taking a lot of my time (it's getting close to done though) and once I finish that then I'll refocus my attention on this plugin and try to add a lot more features. If you have any suggestions as how to do this, those are more than welcomed!

stgram commented 11 years ago

So, to sum up: If you hadnt wrote that code about duplication, everything is simple, with combinatorics, as I posted. The formula: (Blocks-of-the-same-id/Total-blocks)^3*5 Now, if we have 10 different items, there will be almost no duplications to ommit. But, if using only 2,3 or 4 item ids, your 3 lines code change a lot. So, I rewrote your code in C++(I cant java yet :/), and then I get the exact results, fora few seconds time.

There can be a whole study on varying the chances via the config, many possibilities are present. If you want a high winning chance, at least one of the items have a high number. Lets say, 50,10,5,2, this one results in a total of 102% win rate. (Note that in a single game 2 or 3 lines could be won and this is why the chance is over 100%) But if we try 20,20,10,10, this one is just 35%. The 20 blocks have a chance of 15% each, but as for the 10s, it drops on 3%. And this is really tricky...one must play a lot with the numbers.

Entering 20,20,15,10,8,4,2 gives us a winning chance of less than 20%, one in five wins something, that means, that even the smallest prizes will be won very rarely, this might not be in the taste of the player.

As for excel, it is still useful, you enter the chance and prizes, it calculates how much money is won vs how much is spent, so you can adjust, of course for a casino we would want less than 100%.

I found a nice combination for my server, and I am currently testing it with the users, so no rush on a new system, this one does work.

Maybe a JS tool would be useful, for online calculations, but I dont really have the will to rewrite it, also, for now, I dont want competiting servers in my country to get their hands on my work, we are having somewhat of a server feud here...

As for comming up with a new chance mechanism, this could be given a thought. Yours is truly the most realistic, resembling a real one, but...if I come up with something new, I will post.

graywolf336 commented 8 years ago

Curious to hear if you're still using the plugin and have come up with anything better than you had.

stgram commented 8 years ago

I'm no longer playing minecraft for quite the time now, but despite the initial negative comment I see I have left here, I actually managed to use your plugin quite nicely. As far as I remember, I had created a script to randomize the block count and then test every one of them to calculate the chances, from which I then selected the ones I wanted to use. Kind of brute-forcing the combinations, instead of trying to reverse engineer the concept, which I complained was impossible. It worked flawlessly, as I also mentioned, combined with an excel spreadsheet to calculate the total winning chances. If I ever go back to minecraft I will totally use the plugin again, gambling with items, money and command gifts(integration with everything else on the server) is the most addictive thing ever and the players love it.