We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Need help to fix my code! Thank you first of all. Check out the source code on my GitHub here!
Is it Processing code? All I see is .java files.
Also, what's wrong with it? What works? What doesn't? What should it do?
public void swapTile(Tile tile1,Tile tile2) { final int row1 = tile1.getRow(); final int row2 = tile2.getRow(); final int col1 = tile1.getCol(); final int col2 = tile2.getCol(); final int drow = Math.abs(row1 - row2); final int dcol = Math.abs(col1 - col2); System.out.println(drow + "," + dcol); if((drow == 1 && col1 == col2) || (dcol == 1 && row1 == row2)) { final Tile toSwap = Tile.copy(tile1); tiles[row1][col1] = tile2; tiles[row2][col2] = toSwap; } }
you don't update the tiles themselves with their new positions
Thank you for the responses. I have found the problems and it has been fixed :D
Answers
Is it Processing code? All I see is .java files.
Also, what's wrong with it? What works? What doesn't? What should it do?
you don't update the tiles themselves with their new positions
Thank you for the responses. I have found the problems and it has been fixed :D