2048: Difference between revisions

222 bytes removed ,  5 years ago
No edit summary
Line 6,346:
return
ok
pdownnew()
pmovedown()
newnum()
 
func pdownnew()
if gameover() = 1
return
ok
pmovedown()
 
func pup()
Line 6,360 ⟶ 6,353:
return
ok
pupnew()
pmoveup()
newnum()
 
func pupnew()
if gameover() = 1
return
ok
pmoveup()
 
func pleft()
Line 6,374 ⟶ 6,360:
return
ok
pleftnew()
pmoveleft()
newnum()
 
func pleftnew()
if gameover() = 1
return
ok
pmoveleft()
 
func pright()
Line 6,388 ⟶ 6,367:
return
ok
prightnew()
pmoveright()
newnum()
 
func prightnew()
if gameover() = 1
return
ok
pmoveright()
 
func pmoveleft()
Line 6,408 ⟶ 6,380:
next
movetilesleft(n,moveleft)
next
 
func movetilesleft(nr,moveleft)
for p = 1 to (len(moveleft) - 1)
button[p][nr] {temp1 = text()}moveleft[p]
buttontemp2 = moveleft[p+1][nr] {temp2 = text()}
temp = string(number(temp1) + number(temp2))
if (temp1 = temp2) and (temp1 != '0') and (temp2 != '0') and (temp1 != '') and (temp2 != '')
if temp != string(number(temp1)'0' +and temp != number(temp2))''
moveleft[p] = temp
del(moveleft,p+1)
ok exit
next ok
for n = 1 to len(moveleft)
c1 = (moveleft[n] = '')
c2 = (moveleft[n] = '0')
if c1 or c2
del(moveleft,n)
ok
next
Line 6,452 ⟶ 6,420:
 
func movetilesright(nr,moveright)
for pflag = len(moveright) - 1 to 1 step -10
for p = len(moveright) to button[p][nr]2 {temp1step = text()}-1
buttontemp1 = moveright[p+1][nr] {temp2 = text()}
iftemp2 = c1 or c2moveright[p-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 != ''
if gameover() flag = 1
moveright[p] = temp
del(moveright,p+-1)
exit
ok
Line 6,488 ⟶ 6,458:
 
func movetilesup(nr,moveup)
pdownnew() flag = 0
for p = 1 to len(moveup) - 1
button[nr][p] {temp1 = text()}moveup[p]
button[nr] temp2 = moveup[p+1] {temp2 = text()}
if (temp1 = temp2) and (temp1 != '0') and (temp2 != '0') and (temp1 != '') and (temp2 != '')
temp = string(number(temp1) + number(temp2))
if temp != '0' and temp != ''
if gameover() flag = 1
moveup[p] = temp
del(moveup,p+1)
exit
ok
ok
Line 6,524 ⟶ 6,496:
 
func movetilesdown(nr,movedown)
if gameover()flag = 10
for p = 1 to len(movedown) - 1
button[nr][size-p+1] {temp1 = text()}movedown[p]
button[nr][size-p] {temp2 = text()}movedown[p+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 != ''
c1 = (moveleft[n] flag = '')1
movedown[p] = temp
del(movedown,p+1)
Line 6,581 ⟶ 6,555:
}
}
 
func showarray(vect)
ok see "["
if gameover()svect = 1""
for n = 1 to len(moveleftvect)
c2 svect = (moveleftsvect + vect[n] =+ " '0')"
returnnext
svect = left(svect, len(svect) - 1)
pupnew() see svect
see "]" return+ nl
 
class MyButton from qPushButton
2,468

edits