DECLARE SUB DrawScreen () DECLARE SUB Center (row%, text$) DECLARE SUB Set (row%, col%, acolor%) DECLARE FUNCTION PointIsThere% (row%, col%, acolor%) DEFINT A-Z '$DYNAMIC TYPE arenaType realRow AS INTEGER acolor AS INTEGER sister AS INTEGER END TYPE CONST TRUE = -1 CONST FALSE = NOT TRUE DIM SHARED arena(1 TO 50, 1 TO 80) AS arenaType, ColorTable(10) GOSUB SetColors DrawScreen COLOR 7, 0 CLS SYSTEM SetColors: RESTORE mono FOR a = 1 TO 6 READ ColorTable(a) NEXT a RETURN mono: DATA 15,7,7,0,15,0 normal: DATA 14,13,12,1,15,4 SYSTEM REM $STATIC SUB Center (row, text$) LOCATE row, 41 - LEN(text$) / 2 PRINT text$; END SUB SUB DrawScreen VIEW PRINT COLOR ColorTable(1), ColorTable(4) CLS Center 11, "Inicializando Campo de Jogo..." FOR row = 1 TO 50 FOR col = 1 TO 80 arena(row, col).realRow = INT((row + 1) / 2) arena(row, col).sister = (row MOD 2) * 2 - 1 NEXT col NEXT row END SUB SUB InitColors FOR row = 1 TO 50 FOR col = 1 TO 80 arena(row, col).acolor = ColorTable(4) NEXT col NEXT row COLOR , ColorTable(4) CLS FOR col = 1 TO 80 Set 3, col, ColorTable(3) Set 50, col, ColorTable(3) NEXT col FOR row = 4 TO 49 Set row, 1, ColorTable(3) Set row, 80, ColorTable(3) NEXT row END SUB FUNCTION PointIsThere (row, col, acolor) IF row <> 0 THEN IF arena(row, col).acolor <> acolor THEN PointIsThere = TRUE ELSE PointIsThere = FALSE END IF END IF END FUNCTION SUB Set (row, col, acolor) IF row <> 0 THEN arena(row, col).acolor = acolor realRow = arena(row, col).realRow topFlag = arena(row, col).sister + 1 / 2 sisterRow = row + arena(row, col).sister sisterColor = arena(sisterRow, col).acolor LOCATE realRow, col IF acolor = sisterColor THEN COLOR acolor, acolor PRINT CHR$(219); ELSE IF topFlag THEN IF acolor > 7 THEN COLOR acolor, sisterColor PRINT CHR$(223); ELSE COLOR sisterColor, acolor PRINT CHR$(220); END IF ELSE IF acolor > 7 THEN COLOR acolor, sisterColor PRINT CHR$(220); ELSE COLOR sisterColor, acolor PRINT CHR$(223); END IF END IF END IF END IF END SUB