7GQ5TOWHFPXHGR7RFYWHWWMO32MDSVVK7WRLWDEROVTKCQRHRMTAC AHABKD5VEK5RSTM3CME4XJAHCVTHYV2D2WAWUGSJ6PBUCUI7CB3AC FKENDSMEJXEZPAT6K5TYJC2KZBVYKMXA7LN7ZVPZMYIBODWIB64AC LYLOM4SPCNQX64J76E7WDGCXPJOJ2GTSLJCDREJJFZY46HGMCR3QC GVX7YSQYURPWFSUWVUAORZJTQBJURWWNBNUGEZYFAUMX3X5LSACQC 4IBBQBYGBZDCXQO5C7H6UTWT67YJUJ7R6FH6UNHX4QGXOO47UUBQC MUADNESBQPELEGUUCGMPUZKVQZPUSSNALDW3MWCBJ42MRFWMQF7QC X6AJODURS3K7O6ZNPOJLXFKI73E7OBRJRMBL66UHBDKFZXK4F6RAC 73FZRRIBGT2F6MK4C2JIK4M4BXVKLF5YWRWEERBB7BZ7X4XZCWTQC TRZPDEYAE6S3FP7NKTNKQLECPVV2LRKGC7PJCC2MHPXDLU7CAABQC table.insert(cands, {x=x-1, y=y, prev=cand})table.insert(cands, {x=x+1, y=y, prev=cand})table.insert(cands, {x=x, y=y-1, prev=cand})table.insert(cands, {x=x, y=y+1, prev=cand})
table.insert(cands, {x=x-1, y=y, dir='left', prev=cand})table.insert(cands, {x=x+1, y=y, dir='right', prev=cand})table.insert(cands, {x=x, y=y-1, dir='up', prev=cand})table.insert(cands, {x=x, y=y+1, dir='down', prev=cand})
table.insert(undo_history, u)
if add_to_undo thentable.insert(undo_history, u)endendfunction plan_move_to_empty_space(y, x)local path = find_path(level_state, player, {y=y, x=x})if path == nil then return endpending_moves = unwind_steps(path, {})local src = level_state[player.y][player.x]local dest = level_state[y][x]local u = {{x=player.x, y=player.y, cell=src},{x=x, y=y, cell=dest}}table.insert(undo_history, u) -- add to undo without making move yetnext_pending_move = Current_timeendfunction car.update()if next_pending_move and Current_time >= next_pending_move thenif #pending_moves > 0 thenlocal dir = table.remove(pending_moves)move(dir, --[[add to undo]] false)next_pending_move = Current_time + 0.1endend
elseif chord == 'left' thenmove_left()elseif chord == 'right' thenmove_right()elseif chord == 'up' thenmove_up()elseif chord == 'down' thenmove_down()
elseif chord == 'left' or chord == 'right' or chord == 'up' or chord == 'down' thenmove(chord, --[[add to undo]] true)