I am designing Classic Snake game using OOPS.I will have the following classes at top level :
Game
{
Board board,
Snake snake;
}
Board
{
Cell cells[];
}
Cell
{
int x,
int y,
Type type;
}
Type
{
SNAKE,
FOOD,
EMPTY
}
Snake
{
List<Cells> snakeParts;
}
I am a little confused on following point:
Can snake be part of Board class as follow?
Board
{
Cell cells[];
Snake snake;
}
Like instead of Game class having Snake object, is it better for Board class to have snake object?Because it makes sense to say that BOARD ‘has-a’ snake instead of Game ‘has-a’ snake .