Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool move(int tile)
- {
- int blank;
- for (int i = 0; i < d; i++)
- {
- for (int j = 0; j < d; j++)
- {
- if(board[i][j] == 0)
- {
- blank = board[i][j];
- }
- if(tile == board[i-1][j] || board[i+1][j] || board[i][j-1] || board[i][j+1])
- {
- int temp = tile;
- tile = blank;
- blank = temp;
- return true;
- }
- else
- {
- return false;
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement