I have made a function called game_over which returns a boolean based on whether a grid representing a 2048 game is in a game over situation. If it is it returns false if it is not it would return true.
The function works perfectly except in one situation where there is one zero left it would return true and I can not figure out why this is. It should if there is a zero return false as it goes into the first for loop which checks if there is a zero. What is going on here?
Thank you for your reply. I am using a function called twod_to_oned which allows me to used 2D indices on a vector as you can see above. Using this I am able to locate numbers in the vector using their row and coloumn index.
The requirements for the task permits me from doing this, otherwise I would have. Regardless, these two functions should be working but it is very confusing why it is not.
If it is working with all other values except in the last part when there is only one zero left this could mean that there is some error with my other functions?