Recommend
5 
 Thumb up
 Hide
8 Posts

Bug» Forums » General

Subject: Simple AI and some statistics rss

Your Tags: Add tags
Popular Tags: [View All]
Tommy Knudsen
Denmark
Vejle
flag msg tools
Avatar
mb
I implemented the bug rules to a simple MCTS(Monte Carlo Tree Search) AI.
It only plays on hexhex3 for now.
I have no idea how strong it is, let me know if you can beat it(and if so how hard you think it is)

To play against it download it here:
Windows
Linux
Source Code

Parameters: play.exe time playouts v
time is how long the AI should think for(default is 15).
playouts is how many games the AI should play trough before deciding on a move, if it's 0, time is used to limit the AI, if it's not zero playouts are used instead(minimum is probably ~700)
if you write v as the third parameter the AI will show it's ratings for each possible move on the current board
Who starts is random
Do note that the program may crash if you set time or playouts too low(it doesn't get a chance to try out each possible move)

Unzip and run it like this in command line(examples):
play.exe for 15 second think time
play.exe 0 1500 v for 1500 playouts and write move ratings

The program will accept three different kind of notations illustrated on the image below:


To note where grow placements are the notation becomes:
place;grow1;grow2;...

Example:
C3;C2;D2

And finally some statistics on the AI playing against itself(X is the first player):
Games: 412
X wins: 229 - 55.58%
O wins: 183 - 44.42%
Avg moves in games: 21.34
Lowest number of moves in a game:10 in game 88
Highest number of moves in a game:34 in game 71
Largest bug size: 7 in game 243

Let me know if you encounter any bugs/errors
6 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Nick Bentley
United States
Madison
Wisconsin
flag msg tools
designer
badge
Avatar
mbmbmbmbmb
Wow! Thanks for doing this. The stats are really interesting.
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Rahn
Australia
Melbourne
Victoria
flag msg tools
Avatar
mbmbmbmbmb
I found that the program wasn't always letting me eat opponent's bugs of the same shape but different rotation or reflection. I'm pretty sure my move was legal but in one instance the program said it was an illegal move. In a second instance I tried a two stage eat and grow. The first placement ate a small bug and caused growth, which then should have led to the eating of a second shape and more growth. I plugged in all three moves at once into the command line. It let me do all 3 moves (growing twice) but it did not eat the second opponent's bug it should have.
1 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Tommy Knudsen
Denmark
Vejle
flag msg tools
Avatar
mb
TumbleSteak wrote:
I found that the program wasn't always letting me eat opponent's bugs of the same shape but different rotation or reflection. I'm pretty sure my move was legal but in one instance the program said it was an illegal move. In a second instance I tried a two stage eat and grow. The first placement ate a small bug and caused growth, which then should have led to the eating of a second shape and more growth. I plugged in all three moves at once into the command line. It let me do all 3 moves (growing twice) but it did not eat the second opponent's bug it should have.


If you can provide me with the moves of the games I can look into it. I did have problems with bug eating previously, but I though all the errors were fixed.
1 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Tommy Knudsen
Denmark
Vejle
flag msg tools
Avatar
mb
milomilo122 wrote:
Wow! Thanks for doing this. The stats are really interesting.


Speaking of interesting things, the AI played this game that ended with the whole board filled: Link

I looked the game over and didn't spot any illegal moves or missing eats(now I'm paranoid because of the troubles Rahn had).
So to answer the question in another thread(Board Size), apparently you do need at least 10 of each color for hexhex3.
1 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Asa Stewart
msg tools
Avatar
mbmbmbmb
I'm playing with the windows version and it seems to be not letting legal moves. This is a sample -

I'm circles

Enter move:18
O . .
. . . .
. . . . .
X . . .
. . .
(1, 0, -1)
O . .
. . X .
. . . . .
X . . .
. . .
Enter move:12
Illegal move
Enter move:3
O . .
. . X .
. . . . .
X . . O
. . .
(-1, -1, 2)
O . .
. . X .
. . . . .
X . . O
. X .
Enter move:11
Illegal move
Enter move:


I should be able to place a circle next to a cross and eat it and expand to 2 circles and not cause a merger. Often the game never allows any placing or eating and just gets stuck saying illegal move. As in the case above, where it doesn't allow me to place anywhere on the board.
2 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Tommy Knudsen
Denmark
Vejle
flag msg tools
Avatar
mb
astrowhiz wrote:
I'm playing with the windows version and it seems to be not letting legal moves. This is a sample -

I'm circles

Enter move:18
O . .
. . . .
. . . . .
X . . .
. . .
(1, 0, -1)
O . .
. . X .
. . . . .
X . . .
. . .
Enter move:12
Illegal move
Enter move:3
O . .
. . X .
. . . . .
X . . O
. . .
(-1, -1, 2)
O . .
. . X .
. . . . .
X . . O
. X .
Enter move:11
Illegal move
Enter move:


I should be able to place a circle next to a cross and eat it and expand to 2 circles and not cause a merger. Often the game never allows any placing or eating and just gets stuck saying illegal move. As in the case above, where it doesn't allow me to place anywhere on the board.


Sorry it took so long for me to reply, the problem you're having is you need to include the grow in your move notation.
Your example "Enter move:12" has to be one of 12;7 or 12;8 or 12;13 or 12;16.
1 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Asa Stewart
msg tools
Avatar
mbmbmbmb
Ah ok thanks. I forgot to subscribe to this thread so didn't see your reply either blush
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Front Page | Welcome | Contact | Privacy Policy | Terms of Service | Advertise | Support BGG | Feeds RSS
Geekdo, BoardGameGeek, the Geekdo logo, and the BoardGameGeek logo are trademarks of BoardGameGeek, LLC.