http://pastebin.com/AMgv2q5A.. my code and errors are: :( 3x3.txt wins the 3x3 board \ expected prompt for input, not exit code of 0 :( 4x4.txt wins the 4x4 board \ expected prompt for input, not exit code of 0


Simply put, your program doesn't check for a win correctly. It returns what are called "false positives", saying that a game has been won when it hasn't. It will indicate a win anytime a 1 is in the upper left tile and it doesn't matter what else is where. (I will say that the result returned by check50 doesn't really tell you much, but that's another problem.)

Your win() function has a serious flaw. Even though you set up nested loops to check every array element or tile, when it checks the first one, it will either return true or return false. Either way, it's going to return, thus exiting the loop. You need to check all of the elements in the array before returning a true. If it finds a false, an immediate return is correct.

If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .