Some Toaster AI improvements
I made some more improvements to Toaster yesterday and this morning. Specifically:
Have Toaster look for an enemy tile to place Grenades on
Before, Toaster looked for an empty space on the grid to place whatever tile it was holding. Now, if that tile is a grenade, it looks for an enemy tile to place it on. If it can’t find one, it picks another tile from its queue instead because placing grenades on empty grid spaces is pointless. Right now this will break the game if all three tiles in Toaster’s queue are grenades (because it’ll keep trying them one after the other indefinitely, never actually making a move) and that’s something I’ll be fixing today.
More variation in placement
Before, Toaster looped through its chosen line and placed a tile on the first empty space it could find. For example:
Toaster sees that Human has 3 tiles in a row in column 5, in positions 1, 2, and 3 respectively.
It loops through each position in that column, looking for an empty spot to place its own tile on to intercept the player.
It sees empty position 4, places its tile there.
Human places a grenade in position 4 and blows up the just-placed tile.
Toaster immediately places its next tile in position 4 again.
If the human had an infinite number of grenades and kept blowing away that one tile, Toaster would just keep placing a tile there over and over. In theory this isn’t a problem if position 4 is actually the best place for it to move, but that’s not the reason Toaster would be doing this - the reason would be simply that Toaster uses the first empty position it finds and places its tile in that place. Now, there’s a bit more variety because I’m having Toaster make a list of all possible positions that it could place its tile onto and then pick one at random. Not really the most strategic approach, but at least a little more varied.
I should note that these updates aren’t live yet. I’m still testing and making some more changes.