Well, you follow the letter of the law in for the first two pointsrequirements, as you are using a single god-object containing everything, and it's defined over multiple classes, which are only ever used to inherit for building the full class.
That's probably not what your teacher wanted, but who knows.
Abstain from importing wholesale huge open-ended namespaces like std
into the global scope. Read "Why is "using namespace std" considered bad practice? " for the reasons.
playAgain()
and playGame()
are mutually recursive without break-condition. So, how to stop? Waiting until the stack overflows is not a solution!
Do you know switch
-statements? Far preferable to long chains of if
-Statements where applicable.
If you want to output a sngle character with iostreams, consider using a character-literal instead a short string-literal. Likely slightly more efficient.
Consider making your playfield a donut, like the classic snake-game uses. Next, save it as a matrix (including walls, snake-parts and food), and you can use that to easily test collisions, eating, and placing more food. That matrix-class (dynamically sized or not) would make a useful class for more than playing-fields...
So, you need a 2d-matrix for the playing-field, a struct for coordinates, a class representing a player (score, lives, name, alive, snake-head-coordinates, snake-tail-coordinates (rest of snake seen on the board), snake-length, snake-real-length), maybe derived from that a human player and later a (probably pretty dumb) ai player.
Last, you can have a class for the game that connects everything together.
That seems to better follow both the letter and the spirit of your instructions.
Well, you follow the letter of the law in for the first two points, as you are using a single god-object containing everything, and it's defined over multiple classes, which are only ever used to inherit for building the full class.
That's probably not what your teacher wanted, but who knows.
Abstain from importing wholesale huge open-ended namespaces like std
into the global scope. Read "Why is "using namespace std" considered bad practice? " for the reasons.
playAgain()
and playGame()
are mutually recursive without break-condition. So, how to stop? Waiting until the stack overflows is not a solution!
Do you know switch
-statements? Far preferable to long chains of if
-Statements where applicable.
If you want to output a sngle character with iostreams, consider using a character-literal instead a short string-literal. Likely slightly more efficient.
Consider making your playfield a donut, like the classic snake-game uses. Next, save it as a matrix (including walls, snake-parts and food), and you can use that to easily test collisions, eating, and placing more food. That matrix-class (dynamically sized or not) would make a useful class for more than playing-fields...
So, you need a 2d-matrix for the playing-field, a struct for coordinates, a class representing a player (score, lives, name, alive, snake-head-coordinates, snake-length, snake-real-length), maybe derived from that a human player and later a (probably pretty dumb) ai player.
Last, you can have a class for the game that connects everything together.
That seems to better follow both the letter and the spirit of your instructions.
Well, you follow the letter of the law for the first two requirements, as you are using a single god-object containing everything, and it's defined over multiple classes, which are only ever used to inherit for building the full class.
That's probably not what your teacher wanted, but who knows.
Abstain from importing wholesale huge open-ended namespaces like std
into the global scope. Read "Why is "using namespace std" considered bad practice? " for the reasons.
playAgain()
and playGame()
are mutually recursive without break-condition. So, how to stop? Waiting until the stack overflows is not a solution!
Do you know switch
-statements? Far preferable to long chains of if
-Statements where applicable.
If you want to output a sngle character with iostreams, consider using a character-literal instead a short string-literal. Likely slightly more efficient.
Consider making your playfield a donut, like the classic snake-game uses. Next, save it as a matrix (including walls, snake-parts and food), and you can use that to easily test collisions, eating, and placing more food. That matrix-class (dynamically sized or not) would make a useful class for more than playing-fields...
So, you need a 2d-matrix for the playing-field, a struct for coordinates, a class representing a player (score, lives, name, alive, snake-head-coordinates, snake-tail-coordinates (rest of snake seen on the board), snake-length, snake-real-length), maybe derived from that a human player and later a (probably pretty dumb) ai player.
Last, you can have a class for the game that connects everything together.
That seems to better follow both the letter and the spirit of your instructions.
Well, you follow the letter of the law in for the first two points, as you are using a single god-object containing everything, and it's defined over multiple classes, which are only ever used to inherit for building the full class.
That's probably not what your teacher wanted, but who knows.
Abstain from importing wholesale huge open-ended namespaces like std
into the global scope. Read "Why is "using namespace std" considered bad practice? " for the reasons.
playAgain()
and playGame()
are mutually recursive without break-condition. So, how to stop? Waiting until the stack overflows is not a solution!
Do you know switch
-statements? Far preferable to long chains of if
-Statements where applicable.
If you want to output a sngle character with iostreams, consider using a character-literal instead a short string-literal. Likely slightly more efficient.
Consider making your playfield a donut, like the classic snake-game uses. Next, save it as a matrix (including walls, snake-parts and food), and you can use that to easily test collisions, eating, and placing more food. That matrix-class (dynamically sized or not) would make a useful class for more than playing-fields...
So, you need a 2d-matrix for the playing-field, a struct for coordinates, a class representing a player (score, lives, name, alive, snake-head-coordinates, snake-length, snake-real-length), maybe derived from that a human player and later a (probably pretty dumb) ai player.
Last, you can have a class for the game that connects everything together.
That seems to better follow both the letter and the spirit of your instructions.
Well, you follow the letter of the law in for the first two points, as you are using a single god-object containing everything, and it's defined over multiple classes, which are only ever used to inherit for building the full class.
That's probably not what your teacher wanted, but who knows.
Abstain from importing wholesale huge open-ended namespaces like std
into the global scope. Read "Why is "using namespace std" considered bad practice? " for the reasons.
playAgain()
and playGame()
are mutually recursive without break-condition. So, how to stop? Waiting until the stack overflows is not a solution!
Do you know switch
-statements? Far preferable to long chains of if
-Statements where applicable.
If you want to output a sngle character with iostreams, consider using a character-literal instead a short string-literal. Likely slightly more efficient.
Consider making your playfield a donut, like the classic snake-game uses. Next, save it as a matrix (including walls, snake-parts and food), and you can use that to easily test collisions, eating, and placing more food. That matrix-class (dynamically sized or not) would make a useful class for more than playing-fields...
So, you need a 2d-matrix for the playing-field, a struct for coordinates, a class representing a player (score, lives, name, alive, snake-head-coordinates), maybe derived from that a human player and later a (probably pretty dumb) ai player.
Last, you can have a class for the game that connects everything together.
That seems to better follow both the letter and the spirit of your instructions.
Well, you follow the letter of the law in for the first two points, as you are using a single god-object containing everything, and it's defined over multiple classes, which are only ever used to inherit for building the full class.
That's probably not what your teacher wanted, but who knows.
Abstain from importing wholesale huge open-ended namespaces like std
into the global scope. Read "Why is "using namespace std" considered bad practice? " for the reasons.
playAgain()
and playGame()
are mutually recursive without break-condition. So, how to stop? Waiting until the stack overflows is not a solution!
Do you know switch
-statements? Far preferable to long chains of if
-Statements where applicable.
If you want to output a sngle character with iostreams, consider using a character-literal instead a short string-literal. Likely slightly more efficient.
Consider making your playfield a donut, like the classic snake-game uses. Next, save it as a matrix (including walls, snake-parts and food), and you can use that to easily test collisions, eating, and placing more food. That matrix-class (dynamically sized or not) would make a useful class for more than playing-fields...
So, you need a 2d-matrix for the playing-field, a struct for coordinates, a class representing a player (score, lives, name, alive, snake-head-coordinates, snake-length, snake-real-length), maybe derived from that a human player and later a (probably pretty dumb) ai player.
Last, you can have a class for the game that connects everything together.
That seems to better follow both the letter and the spirit of your instructions.
Well, you follow the letter of the law in for the first two points, as you are using a single god-object containing everything, and it's defined over multiple classes, which are only ever used to inherit for building the full class.
That's probably not what your teacher wanted, but who knows.
Abstain from importing wholesale huge open-ended namespaces like std
into the global scope. Read "Why is "using namespace std" considered bad practice? " for the reasons.
playAgain()
and playGame()
are mutually recursive without break-condition. So, how to stop? Waiting until the stack overflows is not a solution!
Do you know switch
-statements? Far preferable to long chains of if
-Statements where applicable.
If you want to output a sngle character with iostreams, consider using a character-literal instead a short string-literal. Likely slightly more efficient.
Consider making your playfield a donut, like the classic snake-game uses. Next, save it as a matrix (including walls, snake-parts and food), and you can use that to easily test collisions, eating, and placing more food. That matrix-class (dynamically sized or not) would make a useful class for more than playing-fields...
So, you need a 2d-matrix for the playing-field, a struct for coordinates, a class representing a player (score, lives, name, alive, snake-head-coordinates), maybe derived from that a human player and later a (probably pretty dumb) ai player.
Last, you can have a class for the game that connects everything together.
That seems to better follow both the letter and the spirit of your instructions.