hi, i wanted to write a number puzzle ( 4*4 square that contains numbers from 1 to 15 and a empty space and you should keep swapping the empty space with one of the neighboring numbers until the numbers are ordered in the following way:
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15
I know how to program it but i encountered a problem:
How will i take the instructions to swap
I thought of using arrows (up swaps the empty space with the number above and so on) but how will i take the arrows as input? Then i thought of replacing the arrows with (w,a,s,d) but how can i take them directly (without the user having to press enter after each move)?
If there are any solutions for these problems please provide me with solutions
If there arent solutions please provide me with other ideas to do it