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