16 puzzle game: Difference between revisions
Content added Content deleted
Line 245: | Line 245: | ||
void local fn move( tag as int ) |
void local fn move( tag as int ) |
||
int r, rc = (tag mod 10) |
int r, a, b, c, rc = (tag mod 10) |
||
select tag / 10 |
select tag / 10 |
||
case |
case _up : a = rc : b = a + 8 : c = +4 |
||
case _right : a = rc * 4 : b = a - 2 : c = -1 |
|||
case |
case _down : a = rc + 12 : b = a - 8 : c = -4 |
||
case _left : a = rc * 4 - 3 : b = a + 2 : c = +1 |
|||
case _up |
|||
⚫ | |||
⚫ | |||
⚫ | |||
case _down |
|||
for r = rc + 12 to 5 step -4 |
|||
swap board[r], board[r-4] |
|||
next |
|||
end select |
end select |
||
⚫ | |||
⚫ | |||
⚫ | |||
if board == winBoard then window 1, @"!!! YOU WON !!!" : text,,fn colorRed |
if board == winBoard then window 1, @"!!! YOU WON !!!" : text,,fn colorRed |
||
fn drawBoard |
fn drawBoard |