java board game theory

Posted 07 March 2008 - 09:14 AM

I am trying to make a board game but having little success. Could someone explain to me the logic behind such a game like checkers. Should I use a 2d array or...?
I am not asking for code, but a logical sequence/algorithm
thanks,
-R

Replies To: java board game theory

Re: java board game theory

Posted 07 March 2008 - 09:28 AM

Start with two classes. One to hold the "cell", or place on the board that's dynamic, can contain pieces, etc. If the peices have different states, you may want to make a class for that as well. Make a Board class full of cells and give it methods like Init, Move, isWin, that sort of thing. Keep the class structure that manages state away from the display structure, it will make things easier.

Re: java board game theory

Posted 16 February 2009 - 10:46 AM

baavgai, on 7 Mar, 2008 - 08:28 AM, said:

Start with two classes. One to hold the "cell", or place on the board that's dynamic, can contain pieces, etc. If the peices have different states, you may want to make a class for that as well. Make a Board class full of cells and give it methods like Init, Move, isWin, that sort of thing. Keep the class structure that manages state away from the display structure, it will make things easier.

Hope this helps.

This helps, but i would like to know if it's a good idea to integrate the piece with the board and also if the pieces can be an array in each player class.