0

Hi I have yet another question about game of fifteen. I seem to have implemented by 'won' function correctly. Before this check50 was running and I was getting a pass for everything, excluding the 'won' function. Now I have implemented 'won' it even seems to work but now check50 is not passing the draw checks (something it previously passed) - can anyone help?

Code is here: http://pastebin.com/9qnt6X8H

Thanks

0

The problem is still the won() function. Because of the way it's written, it will return a win anytime the blank tile is in the lower right corner. It doesn't matter where the remaining tiles are located - it never looks at the values of any other tiles to see that they're in the right place. Also, because of the ++ in the if test, it will increment the 0 tile to 1, but since it returns true, this is never printed. The won function still needs a lot of work.

It's failing the move test because after initialization the won() call is intercepting the test and returning a won, so the move can't be executed.

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 .