2048: Difference between revisions
Content added Content deleted
(→{{header|Lua}}: added Lua) |
m (→{{header|Lua}}: small logic change) |
||
Line 8,460: | Line 8,460: | ||
local loopdata = {{0,12,4,1,4,1},{0,12,4,4,1,-1},{1,4,1,0,12,4},{1,4,1,12,0,-4}} |
local loopdata = {{0,12,4,1,4,1},{0,12,4,4,1,-1},{1,4,1,0,12,4},{1,4,1,12,0,-4}} |
||
local ofr,oto,ost,ifr,ito,ist = unpack(loopdata[dir]) |
local ofr,oto,ost,ifr,ito,ist = unpack(loopdata[dir]) |
||
⚫ | |||
self:pack(ofr,oto,ost,ifr,ito,ist) |
self:pack(ofr,oto,ost,ifr,ito,ist) |
||
self:comb(ofr,oto,ost,ifr,ito,ist) |
self:comb(ofr,oto,ost,ifr,ito,ist) |
||
Line 8,487: | Line 8,486: | ||
io.write("Your move (wasd + enter, or q + enter to quit): ") |
io.write("Your move (wasd + enter, or q + enter to quit): ") |
||
local char = io.read() |
local char = io.read() |
||
⚫ | |||
if (char=="a") then self:move(1) |
if (char=="a") then self:move(1) |
||
elseif (char=="d") then self:move(2) |
elseif (char=="d") then self:move(2) |