othello game

Started by
5 comments, last by mike74 18 years, 7 months ago
Has anyone here made an Othello game? I'm making one using minimax, and I'm wondering what heuristic to use. Right now, I just use the number of squares that the computer controls. It seems to work but not as well as I'd like. mike http://www.coolgroups.com/
Mike C.http://www.coolgroups.com/zoomer/http://www.coolgroups.com/ez/
Advertisement
A class I taught had this as an assignment. I have no code by hand right now, but here are some pointers.

Most AIs award the positions taken on the board with some values. Corners are worth the most points (since those can never be retaken), edges a bit less. The squares just across the corners are vulnerable to be retaken, after which the opponent has secured a corner or edge. Something like this:
  { { 10, 2, 7, 7, 7, 7, 2, 10 },    { 2, -4, 1, 1, 1, 1, -4, 2 },    { 7,  1, 1, 1, 1, 1,  1, 7 },    { 7,  1, 1, 1, 1, 1,  1, 7 },    { 7,  1, 1, 1, 1, 1,  1, 7 },    { 7,  1, 1, 1, 1, 1,  1, 7 },    { 7,  1, 1, 1, 1, 1,  1, 7 },    { 7,  1, 1, 1, 1, 1,  1, 7 },    { 2, -4, 1, 1, 1, 1, -4, 2 },    { 10, 2, 7, 7, 7, 7, 2, 10 } };

The number of possible moves you have is important too. If you can force your opponent into certain moves, you have a really big advantage. Check Google for 'potential mobility'.

There are lots of other heuristics, you can find a lot using Google.
Oh, after you have mastered this, and the minimax method, take a look at alphaBeta-searching. With this you can prune your search tree a little more, and maybe search deeper.
Thanks for the tips. I'm guessing you meant this:

{ { 10, 2, 7, 7, 7, 7, 2, 10 },
{ 2, -4, 1, 1, 1, 1, -4, 2 },
{ 7, 1, 1, 1, 1, 1, 1, 7 },
{ 7, 1, 1, 1, 1, 1, 1, 7 },
{ 7, 1, 1, 1, 1, 1, 1, 7 },
{ 7, 1, 1, 1, 1, 1, 1, 7 },
{ 2, -4, 1, 1, 1, 1, -4, 2 },
{ 10, 2, 7, 7, 7, 7, 2, 10 } };

Yours was ten lines, and it should be 8.


mike
http://www.coolgroups.com/
Mike C.http://www.coolgroups.com/zoomer/http://www.coolgroups.com/ez/
So, I should probably multiply the computer values by the grid and then subtract the player values multiplied by the grid?

Initially, I was just looking at the computer's squares.

mike
http://www.coolgroups.com/
Mike C.http://www.coolgroups.com/zoomer/http://www.coolgroups.com/ez/
The number of available moves is important. This is a good value to maximize.
Quote:I'm guessing you meant this:
Oops, was a bit too enthousiastic with the Ctrl-V there, indeed.
Quote:So, I should probably multiply the computer values by the grid and then subtract the player values multiplied by the grid?
Initially, I was just looking at the computer's squares.
Yes, evaluate how much an advantage the computer player has over you. You can do that in one sweep through the grid, BTW.

Then you can start tweaking some variables. As the AP also noted, the number of available moves is important. So you will probably introduce some factors a la:
evaluation = grid-values + factor*possible_moves

If your design can handle it, you could make two versions of the computer player and have them play against each other a few times. The one that wins is most likely to be the better player.
Interesting. Out of curiosity, what kind of search depth do you think I should be able to get with minimax and alpha-beta for Othello? Right now, it seems I can only go about 6 levels deep (it takes a few seconds to a minute on a 400 mhz machine). I didn't really try to optimize it too much, so I'm just sort of wondering how far from optimal I might be now.

mike
http://www.coolgroups.com/
Mike C.http://www.coolgroups.com/zoomer/http://www.coolgroups.com/ez/

This topic is closed to new replies.

Advertisement