https://www.liquidpoker.net/


LP international Poland    Contact            Users: 525 Active, 0 Logged in - Time: 03:47

My first "perfect" AI for a game

New to LiquidPoker? Register here for free!
Forum Index > Poker Blogs
Floofy   Canada. Feb 12 2012 21:33. Posts 8708
Hey guys.

If you want this to be fast, go to TLDR.

First some news about me: still with gf, working a small job + university in computer science.

Recently i've been really interested in programming all kind of AIs (eventually my goal might be to program a poker HU limit bot that will be really tough, but thats way more complex than what i'm doing atm. A chess bot also interest me, but thats too complex for me right now).

Right now, i've programmed a bot for the following game:

There is a number (like 100), and each players does a mathematical operation on that number, one after another. The objective of the game is to be the first to make the number reach 0.

My computer is currently perfect... once he gets the "edge" he is unbeatable.

At first, the game only had 3 options: -1 -2 -3, which resulted in the game being way too simple (strategy was to keep it at a multiple of 4 at all time for the opponement).

Now, i had added -6 and /2 and /3, but i feel its still way too simple of a game (the bot only sometimes needs to use /2 or /3 at the beginning, and then never needs to use it again).

If anyone have suggestions to make it more interesting, let me know. (i can easily put any mathematic operations and the bot will automaticelly find the best solution).

I need "options" that will make the game very complex, right now the bot can just use patterns which makes the whole AI i programmed not so impressive.

TLDR:
I programmed a game where both players try to reach 0 (or less) first. at beginning its something like 500, and both players gets to pick between a series of mathematical operations one after another (-1 -2 -3 /2 /3). However, the problem is the game is way too simple and my AI can easily find the best play and it seems to be repetitive patterns. i want to the options to make the complex and interesting, any suggestions?

0 votes
Facebook Twitter
james9994: make note dont play against floofy, ;(Last edit: 12/02/2012 21:33

TheHuHu3   United States. Feb 12 2012 22:07. Posts 5544

Ban Floofy.

TheHuHu4 coming soon :) 

Floofy   Canada. Feb 12 2012 22:10. Posts 8708

hmm i think i found something that works ok
-2
-5
-8
-13
/2
/3

This seems to be complex enough. it starts at 5000. seems hard to believe that its impossible to win, but it is

james9994: make note dont play against floofy, ;(Last edit: 12/02/2012 22:47

BiNK   United States. Feb 12 2012 23:26. Posts 302

hmmm i think i found something that works ok

Go have sex with gf


Floofy   Canada. Feb 12 2012 23:33. Posts 8708


  On February 12 2012 22:26 BiNK wrote:
hmmm i think i found something that works ok

Go have sex with gf



if your trying to suggest my program must have taken so much time to make that i don't have time to spend with my gf anymore, you are completly wrong, this kind of program is really quick to make. This is not a Poker or Chess AI.

If your trying to suggest programming AIs is nerdy or something, sure it might be, but if i eventually manage to program a strong poker AI it won't be so nerdy anymore i wanted to start with small easier programs.

james9994: make note dont play against floofy, ;(Last edit: 12/02/2012 23:47

terrybunny19240   United States. Feb 12 2012 23:33. Posts 13829

how do u know your bot's solution is perfect? sry if obvious

hmmm the gambling game in KOTOR 2 was cool http://starwars.wikia.com/wiki/Pazaak

it appears to have solid rules/complexity of game. idk if there is any way to play it w/o having to install KOTOR2


Floofy   Canada. Feb 12 2012 23:43. Posts 8708

Well first, i used the mode "-1 -2 -3" where i could easily tell if my bot is perfect (since the optimal strategy is VERY obvious).

Now all i did is change the math operations, but in theory the bot acts the same, there is no reasons it wouldn't work anymore. it is programmed in such a way i can just change the math operations (takes a few seconds) and it still play perfect.

I used what you call a recursive function (something that calls itself) so it basicelly brutes force the whole game in a way similar to chess programs (if i do this, then what if my ennemy does any of his options? then what if do any of my options to any of his options? etc up until the end of the tree.) In chess you have to stop the tree search at some point (chess is too deep), but this game is a lot less complex so it can easily be brute forced entirely, even with nearly 0 thinking time.

I also did a few tests.... i put it at 5000 and the game claims i cannot win, so i tryed a few things and lost horribly every times.

But i guess its not completly impossible there exist a bug somewhere (but i doubt it).

james9994: make note dont play against floofy, ;(Last edit: 12/02/2012 23:52

Floofy   Canada. Feb 13 2012 00:17. Posts 8708

Note: the bot is impossible to beat if you play first and its 5000. However if the starting number is something else, then it could be possible (even tho the bot is perfect). However i can imagine that it would be insanely difficult for an human to beat the bot if the starting number is over 5000. i have no idea if theres a math formula to solve it when options are -2 -5 -8 -13 /2 /3 (but the bot use all options in ways that doesn't seem to have patterns).

james9994: make note dont play against floofy, ;( 

Zorglub   Denmark. Feb 13 2012 00:33. Posts 2870

Why don't you get two bots to play against each other, then you can easily see the tactic they use

I started out with nothing and I still got most of it left 

Floofy   Canada. Feb 13 2012 00:47. Posts 8708

i don't think its very informative but here it is.

note: the way i programmed the bot, if it sees he is in a loosing position (when if ennemy plays perfect, he cannot win), he just does -2

5000
#1 -2
#2 /2
#1 -2
#2 -8
#1 -2
#2 -13
#1 -2
#2 -5
#1 -2
#2 -8
#1 -2
#2 -2
#1 -2
#2 /3
#1 -2
#2 -8
#1 -2
#2 /3
#1 -2
#2 -8
#1 -2
#2 /2
#1 -2
#2 -13
#1 -2
#2 -8
#1 -2
etc (got tired here )

As u can see there doesn't seem to be any logical patterns in his actions.

When the math options where simple (like -1 -2 -3) you could do it easily tho,

james9994: make note dont play against floofy, ;( 

Zorglub   Denmark. Feb 13 2012 01:22. Posts 2870

Of course there is a logical pattern if it plays a perfect game. But I don't quite get it.... If you have programmed it yourself, you should know exactly what tactic it is using?

I started out with nothing and I still got most of it leftLast edit: 13/02/2012 01:27

Floofy   Canada. Feb 13 2012 01:36. Posts 8708

Yes i programmed it and i know what strategy it use, but no human can use that strategy since its a brute force strategy.

I'm not sure if you understand what a brute force strategy is. it involve exploring the whole Tree of all possible plays that can be done. By doing this, it doesn't matter how complex the game is, it will find the best play

Basicelly he first begins with really small numbers (like 20) and determines wether or not it is possible to win if its 20 and its your turn (at this point its really simple even for an human). then it goes to 21 and remember the result of 20, then does same for 22, all of that until it reach 5000, and it remember all of the results so its always really easy to find the best play.

Like if if it knows that when it is your turn and the number is 20 you cannot win, and he is currently having the number 22, he will just use -2.

Then he knows 22 is winning number, so if he have 44, he is NOT going to do /2 (since it would give the opponement a winning number). he just slowly determine all numbers this way.

james9994: make note dont play against floofy, ;(Last edit: 13/02/2012 01:39

Almebeast   Sweden. Feb 13 2012 01:48. Posts 797

cool stuff!

After all is said and done, more is said than done. 

Floofy   Canada. Feb 13 2012 03:21. Posts 8708

if anyone wants to test the program u can pm (also mention if u wanted a possible version or not .... 5000 = impossible, 5002 = "impossible" but really hard.

james9994: make note dont play against floofy, ;( 

Zorglub   Denmark. Feb 13 2012 16:15. Posts 2870


  On February 13 2012 00:36 Floofy wrote:
Yes i programmed it and i know what strategy it use, but no human can use that strategy since its a brute force strategy.

I'm not sure if you understand what a brute force strategy is. it involve exploring the whole Tree of all possible plays that can be done. By doing this, it doesn't matter how complex the game is, it will find the best play

Basicelly he first begins with really small numbers (like 20) and determines wether or not it is possible to win if its 20 and its your turn (at this point its really simple even for an human). then it goes to 21 and remember the result of 20, then does same for 22, all of that until it reach 5000, and it remember all of the results so its always really easy to find the best play.

Like if if it knows that when it is your turn and the number is 20 you cannot win, and he is currently having the number 22, he will just use -2.

Then he knows 22 is winning number, so if he have 44, he is NOT going to do /2 (since it would give the opponement a winning number). he just slowly determine all numbers this way.



If this is the case then you could find the "winning numbers" in advance and then use the math to stay on these numbers, even a human could do that if they knew all the winning numbers. Did you check if there is some kind of pattern in the winning numbers?

I started out with nothing and I still got most of it left 

Floofy   Canada. Feb 14 2012 13:37. Posts 8708

actually this is exactly what the bot does. if he doesn't find "winning numbers" in advance, the tree is so large that his actions takes forever even if the number is just 100. So he just slowly determines if numbers are winning or not, up until 5000, and use what he previous found to find the answer (but he does it in a split second).

Well in theory a human could do it too, but when the number is 5000, it takes a long time to find all winning numbers...

And no, i haven't checked if there's a pattern yet

james9994: make note dont play against floofy, ;( 

Floofy   Canada. Feb 14 2012 14:02. Posts 8708



Here this is all the results for 1-1000
G means its a good a number if its your turn, B means its a bad one
Assuming options are
-2 -5 -8 -13 /2 /3

i can't really think of easy patterns here.

james9994: make note dont play against floofy, ;( 

Zorglub   Denmark. Feb 14 2012 17:55. Posts 2870

Heh nope its hard to spot a pattern there. It looks like there are more winning numbers than losing numbers, so it would be easier for a human to memorize the losing numbers and then avoid them, instead of the other way around.

I started out with nothing and I still got most of it leftLast edit: 14/02/2012 17:56

Floofy   Canada. Feb 15 2012 13:50. Posts 8708

more winning numbers is logical.

Having a loosing number means no matter what option out of the 6 you choose, your opponement will end up with a winning number.
And when you have a winning number, there is always at least one option that will give your opponement a loosing number.

james9994: make note dont play against floofy, ;( 

 



Poker Streams

















Copyright © 2024. LiquidPoker.net All Rights Reserved
Contact Advertise Sitemap