Log.txt is for pset3 is all wrong
My log file is giving me this craziness:
2|0|0|0
14|0|4197595|0
-1998922816|32764|0|27
-1998922816|32764|4197005|0
12
2|0|0|0
14|0|4197595|0
-1998922816|32764|0|27
-1998922816|32764|4197005|0
The move that's printed (12) and the dimensions of the array (4) are correct, but the rest obviously has something very wrong going on. Here's what actually printed to the console during gameplay:
15 14 13 12
11 10 9 8
7 6 5 4
3 1 2 0
Tile to move: 12
15 14 13 0
11 10 9 12
7 6 5 8
3 1 2 4
Not sure what could possibly be happening. Any ideas?
Posted Jul 11, 2016, 12:29 AM UTC · edited
13
The log file is produced by some staff code that dumps the contents of the global "board" variable. Further, they assume you are filling it in [row][column] order.
Did you make your own array and fill it? Are you filling it in [row][column] indexes?
Also: moving tile "12" at the start of the game should be rejected as illegal. There is no empty square into which to move it.
I must have misunderstood the scope of the program, which, sensibly, must have been to simply swap two adjacent blocks. Mine has the the ability to shift entire rows, as in the example above, since in the actual game you can do that. And yes, my board in built on the int board[row][column] they gave in their foundation code.
If you'd like to PM me your code, I'd be glad to take a look.