Log In  

Cart #54184 | 2018-07-15 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

This is a quick and dirty cart exploring some AI methods for boardgames in pico8.

The implemented AIs are:

1- Purely Random
2- Random Avoiding win/loss moves
3- Playing randomly a number of times, counting win/losses and choosing "best" moves
4- MCTS (Monte Carlo Tree Search)

(Method 3 can be thought of as an MCTS of depth 1)

You can switch the AIs that the game uses by changing the AI_cofun table. Player_AI just
let's the player pick the move. You can make two AIs fight each other, or make two players
fight each other too.

It was pretty cool putting the AI co-routines together. The code is not the pretties or the most
token efficient, but I might polish it a bit if I find some time on the summer. Hacks are welcome!

P#54185 2018-07-15 09:34 ( Edited 2018-07-15 13:36)

Sometimes the MCTS will explode on a nil pointer. Players beware!

P#54186 2018-07-15 09:36 ( Edited 2018-07-15 13:36)

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-04-19 10:21:39 | 0.013s | Q:14