[button url=”http://www.gamelogic.co.za/examples/30-games-in-30-days/game27/” size=”large”]CLICK HERE TO PLAY GAME 27[/button]
[divider]
[slogan]This is what Grids did for us today. What can Grids do for you?[/slogan]
Game 27 is our version of the game Line up 4 played on a diamond grid. In our version you have to line up 3. You can also add pieces from two sides of the grid, instead of one. The aim of the game is to line up 3 pieces before your opponent, either horizontally, vertically or diagonally.
Because the game is implemented on a diamond grid (this type of grid is also used in our isometric games), it gives us the possibility to have two directions for “gravity”. The AI is a simple one-move-ahead greedy algorithm. A grid with the same structure (but different data elements) is used for the look-ahead. The AI first looks if there are any next moves that make the computer win; then it looks for any moves that will make the player win (so that it can block them). After this, it looks for moves that allows it to make a line of two; after this it looks for a move the player can make to get a line of two (again, to block it). Finally, if no good moves have been found, it makes a random move.
[divider]
Click here to check out all 30 games
[divider]