views:

78

answers:

1

Hello,

I have a square grid, for a turn based game ( grid is similar to the chess board ), but the moves in the games are different based on whether you have lapped your opponent pawn at least once or not.

i.e if you have not lapped (beaten any of the opponents pawns) in the outer most grid as below

alt text

if you have lapped your opponent pawn once at least, then you get to reach home,this way.Any player having all his pawns reaching "home" first wins.

alt text

The ones in yellow are safe-houses, i.e both the opponent pawn and the player's pawn get to stay in the same grid, this is not considered to be lapping ( the opponent ).The lapped pawn will return to its start point.

Now the question is, what is the effective way to store the paths for the all the pawns.we will have 4 pawns for the player and 4 opponent pawns.

Is there any pattern to store such static information, in a elegant way ?

Thanks for your time

+2  A: 

A List should work just fine. It seems pretty elegant to me.

If there is some overarching need for performance; e.g. you are implementing an automatic player that needs to explore a huge tree of alternative moves, you might consider something else. But the requirements for the data structure will be motivated by your game playing algorithm, and we cannot predict that.

Stephen C
I would need the opponent driven by some AI, it would decide the next move .
panzerschreck