OverlordQ has asked for the wisdom of the Perl Monks concerning the following question:

Greetings monks,

I have begun a quest to drasticaly increase my learning of perl. The quest I have chose, is to create a learning 'bot' that will learn how to play Othello. Not the 1best game of choice to begin with, but a fun game to use.

The first step to begin with is the basic layout of the bot. In order to keep it simple, I will use an already existing game of 2 player Othello, to play against the computer. All the 'bot' will do is output the coordinates of where to move.

For Saving the data, this is where I get stuck. Either I'll have to use a 3 Dimensional Array, or use Tree::MultiNode or Tree::Ternary. Any ideas on other modules to use? Or programming tips would be much appreciated.

Replies are listed 'Best First'.
Re: Othello/Tree-Style Data Storage
by hossman (Prior) on Jun 08, 2003 at 02:53 UTC

    Othello is a particularly tricky game to model, since there isn't a particular orientation to the board, nor is there a "direction" that players "move".

    This is similar to the way tic-tac-toe works ... it doesn't matter how you orient the board, so you want to make sure these two boards are both considered "equal"...

     x | o |         |   |
    ---+---+---   ---+---+---   
     o | x |       o | x |
    ---+---+---   ---+---+---   
       |   |       x | o |
    
    ...and if you are keeping track of the game state, and potential game state, you want to model the board insome way that considers those teh same "state".

    Personally, I'd start with a simpiler game (backgammon is good, because it is very linear) but no matter what game you decide to use, make sure you search for existing documentation on game modeling, strategies, and board "ranking".

    If the main thing you are intested in developing is a learning algorithm, then I would first spend some time looking for an existing framework/API for building an Othello playing bot. (many College AI classes have frameworks like this provided by the instructor which include all of the game modeling you need ... you just impliment some "player" interface.) Then you can focus on what you are really interested in, and not spend a lot of time worrying about modelling the game itself.

    UPDATE: You should definitley consider using Games::Goban for representing boards/pieces, and you probably ought to read up on the SGF Format mentioned in the "See Also" section.

      Its true that there isn't an intrinsic orientation to the board in Othello, (or Tic Tac Toe), however, that shouldn't be an immediate concern for designing the board structure. A 2D array would probably be sufficient for all data-keeping purposes, and a 3-d array if you wish to be able to review the game.

      The no-orientation aspect of the game will play a huge role in the construction of any strategic algorithms(the fun part of this project), as you do not want to waste time reading out future sequences which are equivalent due to the geometry.

      One way to avoid this would be to create equvalence classes of positions on the board. For example you could store center, side and corner data for a tic tac toe game, as opposed to storing x-y coordinates. Think graph theory.

      This is a little vauge, let me know if you'd like some elaboartion. -muoyo
Re: Othello/Tree-Style Data Storage
by BrowserUk (Patriarch) on Jun 08, 2003 at 05:02 UTC

    You might find the discussions here useful. The first link on that page leads to four pages of very clear and useful information that you may find valuable.


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller