I am working on a universal game engine for simple board games, etc. I define the interfaces that will be required for each game. I have classes like IGame, IGameState, IBoardEvaluator and IMove.
I have methods like IGame.PerformMove (IMove move) that I would like to limit. If I play tic-tac-toe, I would like me to use only the specific classes TTTGame, TTTState, TTTMove, etc.
I can come up with several ways to do this, but none of them sound funny. Perhaps all classes can have one common parameter, and I could make sure that it matches.
so IGame<T> has method PerformMove(IMove<T> move)
If this works, I don’t know which class to use for T. Maybe it doesn’t matter.
My other idea is putting a bunch of general parameters on IGame and providing all the classes I need. Therefore i would createclass TTTGame<TTTMove,TTTState,TTTMove....>
This is also not very. Is there a general outline for this?
source
share