razorstorm / SingularityChess

2 stars 1 forks source link

Potential refactor of Game and Board #36

Open razorstorm opened 11 years ago

razorstorm commented 11 years ago

Right now, pieces are owned by Game, and the logic to make a move is also tracked by Game. However, squares (owned by Board) each have a reference to who is standing on them.

Because of this, game state is split between game and board. I'm not sure if a refactor would be helpful.

On one hand: it's bad to keep state in two classes, and might make AI harder. Also, it makes sense to keep pieces and movements logic in the board (since the board is logically the one that has the pieces and controls the movement rules).

On the otherhand: it is impossible to completely decouple Game from the gamestate. It would make sense for Game to hold information such as who's turn it is.

However, since "who's turn it is" isn't too useful in the context of AI (It is useful, but you can easily track that in your AI code), that might be an argument in favor of the refactor.

Derek since you doing AI, the decision of whether to refactor and how will be up to you.

derektli commented 11 years ago

ummm, so far the code works okay. I dont see much trouble right now for AI and remote playing. I suggest we move this issue to next milestone and if we encounter issues there we can refactor at that time.