MUADNESBQPELEGUUCGMPUZKVQZPUSSNALDW3MWCBJ42MRFWMQF7QC
FKENDSMEJXEZPAT6K5TYJC2KZBVYKMXA7LN7ZVPZMYIBODWIB64AC
YYVOTWROJFENEAQ4M4VJPWLODTTX7BTAL3NQSTL2UKJ5VSOEH4JQC
KCUJIKQ6POLGKI26YHZWTD242B7JOSGI4VO4XBSKAU66ARM3EIBQC
GVX7YSQYURPWFSUWVUAORZJTQBJURWWNBNUGEZYFAUMX3X5LSACQC
IMDZUX5WFBYCKZPYGVTSJPONI3ORUDNALX5A2BMUFK3JOZ6DHJWQC
4IBBQBYGBZDCXQO5C7H6UTWT67YJUJ7R6FH6UNHX4QGXOO47UUBQC
function move_to_empty_space(y, x)
local path = unwind_path(find_path(level_state, player, {y=y, x=x}))
if #path == 0 then return end
local src = level_state[player.y][player.x]
local dest = level_state[y][x]
if dest == CELL_WALL or dest == CELL_CRATE or dest == CELL_CRATE_ON_TARGET then
return
end
local u = {
{x=player.x, y=player.y, cell=src},
{x=x, y=y, cell=dest}}
move_player_to(y, x)
remove_player_from(player.y, player.x)
player.x, player.y = x, y
table.insert(undo_history, u)
end