Saturday, 18 December 2010

Moving Blog

This will be my last post here, I am moving my blog to

My new blog is a custom-built Rails app, hosted on Heroku, using Gravatar for avatars, Akismet for anti-spam and Amazon S3 for storing assets.

Saturday, 20 March 2010

Is reversi too difficult?

Much time went into making the AI of reversi strong enough on its higher levels to challenge human players. The highest three levels (of the seven available) are challenging for most human players. On the lower levels, the intention was for it to play as a novice human would play. On the lowest level (beginner) in particular it plays for short-term gains, without considering longer term strategy at all. On each turn, the beginner level plays the move that flips as many of the opponent's pieces, taking a corner if one is available and avoiding squares that would give the opponent a corner on the very next move. This reflects the basic manner in which most novices would tend to play reversi.

Playing each of the other levels 100 times against beginner results in beginner level being whipped 100-0 by every other level. So, it's significantly weaker than all the levels above it, including the one directly above it (intermediate).

All of this makes some of the comments in reviews for Reversi on the App Store all the more surprising:

"Othello is an awesome game I really enjoy playing it but this game is way to difficult even on the easiest setting I cannot beat this game even once I think you should change that" - BjMiller20, Jan 2010
"'s too difficult to win even on the easy setting. After playing it just a few times, I've given up on it. It's no fun if you don't feel like you even have the slightest hope of beating the computer and on the easy setting, you should have at least a 50/50 chance." - Mitchipoo, Jan 2010
"..frak me, the AI is ridiculous! I've played this game for years but I can't beat the game on Beginner! I'm not Einstein, but I should be able to win at that level.." - Nuclear Moose, Oct 2009

Is beginner level really too difficult? I have played against it dozens of times and beaten it without really thinking about where to play, but I'm probably not the best yardstick as I've played thousands of games of reversi.

I thought a good, objective test of the difficulty of the beginner level would be to see how it does against a player that makes completely random moves on every turn. Surely if the player making random moves manages to win a few games, then the AI of the opponent player is weak. With this in mind, I pitted beginner level against a bot playing random (valid) moves on every turn; 100 games with beginner playing black and the random bot playing white, followed by 100 games with colours switched. The results of the 200 games were as follows:

164 games won by beginner (80 as black, 84 as white)
29 games won by random (11 as black, 18 as white)
7 games drawn

Beginner level managed to win 82% of the games against the random bot, suggesting that it is fairly weak.

Most people that have played reversi know that corner squares are important and often determine who wins the game. Adding two very simple rules to the random bot, which are to play a corner if one is available and to avoid playing squares that give away a corner to the opponent on the very next move (otherwise, just to play randomly as before) changes the results to:

85 games won by beginner (40 as black, 45 as white)
111 games won by random (53 as black, 58 as white)
4 games drawn

From this we may conclude that beginner level is pretty weak. It is beaten often by this simple bot. It would only be weaker if it intentionally played moves that were advantageous to the opponent - in other words, if it played to lose. It would appear that amazingly enough some human players play in this way, perhaps thinking they're playing good moves. To those complaining that the beginner level on reversi is too difficult, it really isn't. Learn some basic strategy and you'll find you will be able to beat beginner level quite easily.

UPDATE: The difficulty levels have been spread out a bit, so beginner is now even easier.