unknown error
Oct 7, 2014 10:27:39 GMT 1
Post by bitvast on Oct 7, 2014 10:27:39 GMT 1
I've ported an old BASIC program with a lot of GOTOS which plays a tile game (where the goal is to get the numbers in order but you can only move one tile at a time), and I'm getting the following errors.
tile.bac.c: In function 'main':
tile.bac.c:205:1: error: expected 'while' before '__B2C__PROGRAM__EXIT'
__B2C__PROGRAM__EXIT:
^
tile.bac.c:207:1: error: expected declaration or statement at end of input
}
^
tile.bac.c:172:1: error: label '__B2C__PROGRAM__EXIT' used but not defined
{if(!__b2c__trap){ERROR = 35; if(!__b2c__catch_set) RUNTIMEERROR("INPUT", 55, "tile.bac", ERROR); if(!setjmp(__b2c__jump)) goto __B2C__PROGRAM__EXIT;} }
^
make: *** [tile.bac.o] Error 1
Thanks in advance for any help!
DECLARE grid[3][3]
k = 0
FOR i = 1 TO 3
FOR j = 1 TO 3
INCR k
grid[i][j] = k
NEXT j
NEXT i
i = 3
j = 3
FOR k = 1 TO 40
WHILE i + x > 3 OR i + x < 1 OR \
j + y > 3 OR j + y < 1 OR \
ABS(x) + ABS(y) > 1 OR x + y = 0
x = RANDOM(3) - 1
y = RANDOM(3) - 1
WEND
t = grid[i][j]
grid[i][j] = grid[i + x][j + y]
grid[i + x][j + y] = t
INCR i, x
INCR j, y
NEXT k
m = 1
WHILE 1
k = 0
s = 0
FOR i = 1 TO 3
FOR j = 1 TO 3
INCR k
IF grid[i][j] <> k THEN s = 1
IF grid[i][j] = 9 THEN
PRINT " ";
x = i
y = j
END IF
IF grid[i][j] <> 9 THEN PRINT grid[i][j], " ";
NEXT j
PRINT
NEXT i
IF s = 0 THEN
PRINT "SOLVED"
END
END IF
REPEAT
PRINT "MOVE ", m
INPUT "MOVE WHICH TILE? ", n
FOR i = 1 TO 3
FOR j = 1 TO 3
IF grid[i][j] = n THEN
a = i
b = j
NEXT j
NEXT i
UNTIL ABS(x-a) + ABS(y-b) <= 1
t = grid[x][y]
grid[x][y] = grid[a][b]
grid[a][b] = t
INCR m
WEND
tile.bac.c: In function 'main':
tile.bac.c:205:1: error: expected 'while' before '__B2C__PROGRAM__EXIT'
__B2C__PROGRAM__EXIT:
^
tile.bac.c:207:1: error: expected declaration or statement at end of input
}
^
tile.bac.c:172:1: error: label '__B2C__PROGRAM__EXIT' used but not defined
{if(!__b2c__trap){ERROR = 35; if(!__b2c__catch_set) RUNTIMEERROR("INPUT", 55, "tile.bac", ERROR); if(!setjmp(__b2c__jump)) goto __B2C__PROGRAM__EXIT;} }
^
make: *** [tile.bac.o] Error 1
Thanks in advance for any help!