First steps in "AI" programming


With this version I have included a new game mode vs. CPU. In this mode you can play alone against a computer controlled player.

The actual logic behind the CPU player moves is very rudimentary - 130 lines of code in 2 functions which contain 22 IF statements.

I am sure that there should be a smarter way to do it, but here is what I went for:

1) Create a value matrix where each tile has a preference score how much the player wants to be on that tile. (e.g. Tiles 5 & 6 are very undesirable, while tiles 4 & 8 are very wanted for their bonus roll and protection)

2) Modify the preference score by reducing it if there are enemy pieces before that tile and increase it if there are enemy pieces after it

3) Additional tiles score adjustments to prevent overcrowding the initial 4 pieces base

With these 3 simple rules I was able to reach a satisfactory level of competency that is playing somewhat better than random choice.

Files

web 0.6b.zip Play in browser
Nov 07, 2019

Leave a comment

Log in with itch.io to leave a comment.