I'm going to make a snake remake with SDL library and right now I'm thinking heavily about the object-oriented design.
I can imagine that I will have classes like GameEngine
, Snake
, Board
and Food
, but the interesting part is - how shall they interact between each other? How shall the game logic be designed?
For example, let's imagine here are some of the possibilities:
- Every class except of
GameEngine
will hold only it's data (position of snake, food, etc.). All the game logic will be done in engine'sUpdate()
function. Therefore this function will be very big and every other part of the program fairly small. GameEngine
will only call appropriate functions of every object with the reference toBoard
and these individual functions will take care about the game logic.- something other
So I would like to know your opinion - what approach do you think is the best? I'm not aiming at low number of lines the game will have, but at the quality and "modularity" of the game object design.