2048: Difference between revisions
→{{header|Ring}}
No edit summary |
|||
Line 6,346:
return
ok
pdownnew()▼
pmovedown()
newnum()
if gameover() = 1▼
return▼
ok▼
func pup()
Line 6,360 ⟶ 6,353:
return
ok
pupnew()▼
pmoveup()
newnum()
if gameover() = 1▼
return▼
func pleft()
Line 6,374 ⟶ 6,360:
return
ok
pmoveleft()
newnum()
if gameover() = 1▼
func pright()
Line 6,388 ⟶ 6,367:
return
ok
pmoveright()
newnum()
if gameover() = 1▼
func pmoveleft()
Line 6,408 ⟶ 6,380:
next
movetilesleft(n,moveleft)
func movetilesleft(nr,moveleft)
for p = 1 to
temp = string(number(temp1) + number(temp2))
if (temp1 = temp2) and (temp1 != '0') and (temp2 != '0') and (temp1 != '') and (temp2 != '')
if temp !=
moveleft[p] = temp
del(moveleft,p+1)
for n = 1 to len(moveleft)▼
c1 = (moveleft[n] = '')▼
c2 = (moveleft[n] = '0')▼
if c1 or c2▼
ok
next
Line 6,452 ⟶ 6,420:
func movetilesright(nr,moveright)
for p = len(moveright) to
if (temp1 = temp2) and (temp1 != '0') and (temp2 != '0') and (temp1 != '') and (temp2 != '')
temp = string(number(temp1) + number(temp2))
if temp != '0' and temp != ''
moveright[p] = temp
del(moveright,p
exit
ok
Line 6,488 ⟶ 6,458:
func movetilesup(nr,moveup)
for p = 1 to len(moveup) - 1
if (temp1 = temp2) and (temp1 != '0') and (temp2 != '0') and (temp1 != '') and (temp2 != '')
temp = string(number(temp1) + number(temp2))
if temp != '0' and temp != ''
moveup[p] = temp
del(moveup,p+1)
exit
ok
ok
Line 6,524 ⟶ 6,496:
func movetilesdown(nr,movedown)
for p = 1 to len(movedown) - 1
if (temp1 = temp2) and (temp1 != '0') and (temp2 != '0') and (temp1 != '') and (temp2 != '')
temp = string(number(temp1) + number(temp2))
if temp != '0' and temp != ''
movedown[p] = temp
del(movedown,p+1)
Line 6,581 ⟶ 6,555:
}
}
func showarray(vect)
svect = left(svect, len(svect) - 1)
class MyButton from qPushButton
|