As I said in my last thread about sorting, I am working on a card game. I guess I need a little advice about how to organize the game logic. In the game, players take turns making a move. Only certain moves are available to you on your turn depending on the current state of the game. Occasionally, things happen automatically.
I am not sure where to put all this game logic from an OO point of view. My original plan was to have each player object have a askForMove() method, which will return a Move enum. Depending on what the player decided to do, different things happen. If the player hasn’t decided on a move yet, it just returns a “NONE” type, and the loop goes around again. This requires a lot of error checking because the player may request a move which isn’t actually available. So I have a MoveEvaluater class which decides if a requested move is legal. If it is legal then the MoveEvaluater gives the thumbs up to the Table class to do whatever move was requested.
My question is, is this actually the best way to organize all this? Anyone else have any experience with turned based card games?
I’d like to eventually write an AI which will play the game. So I am worried about implementing this later on.