Anonymous user
Sokoban: Difference between revisions
Updated first D entry
(Updated first D entry) |
|||
Line 792:
private bool move(in int x, in int y, in int dx,
in int dy, ref CTable data)
const pure
if (sData[(y+dy) * ncols + x + dx] == El.wall ||
data[(y+dy) * ncols + x + dx] != El.floor)
return false;
auto data2 = data.dup;
data2[y * ncols + x] = El.floor;
data2[(y + dy) * ncols + x + dx] = El.player;
Line 806:
private bool push(in int x, in int y, in int dx,
in int dy, ref CTable data)
const pure
if (sData[(y + 2*dy) * ncols + x+2*dx] == El.wall ||
data[(y + 2*dy) * ncols + x+2*dx] != El.floor)
return false;
auto data2 = data.dup;
data2[y * ncols + x] = El.floor;
data2[(y + dy) * ncols + x + dx] = El.player;
Line 826:
}
string solve() pure nothrow {
bool[immutable CTable] visitedSet = [dData: true];
Line 838:
tuple(-1, 0, 'l', 'L')];
while (!open.
//immutable (cur, cSol, x, y) = open.pop;
immutable item = open.pop;
|