Javascript Reversi

In the last two days I engaged in developing Reversi, just to learn how the minimax algorithm works. To make it easier to share, and remove GUI toolkit dependencies, my approach was using HTML (a simple page with a 8×8 table), three images (empty cell, black or white cells), a CSS file that fills empty cells or used cells, and highlights movement possibilities, and a couple of JavaScript files (jquery, a reversi-board.js file to handle the board as an object, a reversi.js file to handle the interface between the board and the HTML file, and finally a minimax.js file to handle the minimax algorithm.

At the moment the game is playable, and not too slow. The code can be optimized to make it faster. In the next couple of days I might do that.

Also, regarding the AI code, it can be made better. In one side, the minimax algorithm can try to analyze more moves in advance (only three at the moment), in the other, the board evaluation function can be made better as well.

If you wish to play, go ahead:

Artificial Intelligence for Games errata

This year I am teaching Artificial Intelligence for Games. I grabbed some book PDFs from the Internet (yes, sorry, it would be impossible to buy all the books to choose one, and libraries around doesn’t have books in this thematic) and I chose a pair of books to buy. One of them is this Artificial Intelligence for Games, by Ian Millington and John Funge.

The book is quite complete, the language very accessible, full of code, lots of insights about that developing AI for games means. I really like the book, and I will continue to use in future years if they let me continue teaching this course.

Unfortunately the book is full of small typos and problems. There is an official errata available but it is very incomplete. I started writing my own errata (I’m not repeating the items in the official errata, just adding new errors I find) with some fixes, and some insights on some interpretation problems. I warned Ian Millington about my errata, and he will, hopefully, go through my errata items and decide if they should be included in the official errata. While Ian doesn’t have the time for that, I am sharing my own errata page. Note that I am not professional on this area and I might have misunderstood something…