2048: Difference between revisions

75 bytes removed ,  7 months ago
No edit summary
Line 8,137:
 
=={{header|FutureBasic}}==
 
<syntaxhighlight lang="futurebasic">
 
begin enum 123
_lf
Line 8,153 ⟶ 8,151:
 
void local fn initialize
subclass window 1, @"2048",(0,0,438,440438)
fn WindowSetBackgroundColor( 1, fn ColorBlack )
color(0) = fn ColorDarkGray
color(1) = fn ColorGray
color(2) = fn ColorLightGray
color(3) = fn ColorBrownColorBlue
color(4) = fn ColorBlueColorBrown
color(5) = fn ColorCyan
color(6) = fn ColorGreen
Line 8,171 ⟶ 8,169:
void local fn drawBoard
int x, y,r = 1, add
cls
for y = 320 to 20 step -100
for x = 20 to 320 step 100
Line 8,225 ⟶ 8,222:
short a, b, c, t, moved = 0
// SHIFT
for a = st to st + rd * 3 step rd
// SHIFT
t = a
for b = a to a + cd * 3 step cd
Line 8,234 ⟶ 8,231:
end if
next
// MERGE
next
// MERGE
for a = st to st + rd * 3 step rd
for b = a to a + cd * 2 step cd
if bd[b] > 0 && bd[b] == bd[b+cd]
bd[b]++ : c = b + cd
// FILL IN
while c <> a+cd*3
bd[c] = bd[c+cd] : c += cd
wend
bd[c] = 0
// CHECK FOR WIN
if bd[b] == 11 then fn drawBoard : fn finish( yes ) : exit fn
zs ++ : moved ++
Line 8,252 ⟶ 8,246:
next
next
if moved == 0 then exit fn
fn drawBoard
// GROW
Line 8,263 ⟶ 8,257:
if rnd(10) - 1 then bd[b]++ else bd[b] = 2
zs--
fn drawBoard
timerbegin 0.25
fn drawBoard
timerend
if zs then exit fn
68

edits