1
General discussions / Re: SFML Game Development by Example - 4th SFML book
« on: July 03, 2017, 09:19:44 pm »
Just started going through this book and enjoying it so far. Chapter 3, after introducing the basic code for the snake game, has a section on finding bugs. At the end of this it says:
I'm stumped as to what this could be. I thought this could be referring the case where our world is smaller than the space required to accommodate our hardcoded initial position, but that seems overly paranoid. Also, I've added some code to ensure the apple spawn isnt in a position occupied by the snake. I've looked at the finished code online, and fail to see what is fixed there that wasn't described in the text. Anyone know what this is referring to?
Quote
There's one more fault with the game that didn't get addressed here on purpose. Try to find it and fix it in order to practise resolving problems like this in the future.
Hint: It has to do with how many segments the snake has when the game starts.
I'm stumped as to what this could be. I thought this could be referring the case where our world is smaller than the space required to accommodate our hardcoded initial position, but that seems overly paranoid. Also, I've added some code to ensure the apple spawn isnt in a position occupied by the snake. I've looked at the finished code online, and fail to see what is fixed there that wasn't described in the text. Anyone know what this is referring to?