# Sokoban Level Stacked Dozen

This is one of the new possible maps for the final level of Sokoban in Nethack Fourk. It has 12 boulders and 1 holes, leaving 1 spare boulder.

```The unique challenge is the starting position of the boulders as a stack of twelve in one square.
```

```---------         ------
|.......|     ----|....--  0 stack of 12 boulders
|.......|    --..--.....|  ^ hole
|...<...|  ---......-.|.|  > starting position/downstairs
|.......|  |..........|.|  < upstairs
|.......|  |..0..-......|  + door
-+------------.....--...|
|.^^^^^^^^^^^...|>......|
-------------------------
```

## Strategy

The following solution may not be very fast or organized. Improvements welcome. Like all Sokoban levels it can be solved without making any boulders 'stick'.

The stack of boulders leads to a two part solution of first spreading the boulders out and only then bringing them to their holes, The source code indicates the following positioning, which is slightly modified in the solution below:

```---------         ------
|.......|     ----|....--  0 boulder
|.......|    --..--0.0..|  ^ hole
|...<...|  ---..00..-.|.|  > starting position/downstairs
|.......|  |.0...0..00|.|  < upstairs
|.......|  |..0.0-....0.|  + door
-+------------.....--0..|
|.^^^^^^^^^^^...|>......|
-------------------------
```

All boulders will be replaced by letters so they can be referred to. Moving the boulders is shortened to r for right, l for left, u for up, d for down. An asterisk is used to denote the last move filled a hole (and thus removed the boulder from the game). So "N ddrr*" means move boulder N two times down and two times to the right into a hole.

### Divide

Always start by pushing a boulder from the stack 0 (and all but the two last boulders are first pushed to the right), ending with a new letter for the boulder:

First, let's use the spacious right half of the space available:

```---------         ------   0 ruur rrru → I
|.......|     ----|....--  0 rurr rrrr uu → J
|.......|    --..--.....|  0 rurr rrrr dd → H
|...<...|  ---......-.|.|  0 rurr rrrr dr → G
|.......|  |..........|.|  0 rurr rrrr → K
|.......|  |..0..-......|  0 rurr rrr → L
-+------------.....--...|  0 ruur rr → E
|.^^^^^^^^^^^...|>......|
-------------------------
```

Now to the trickier second half, where we can't push all boulders directly to their resting place:

```---------         ------   0 rurd → F
|.......|     ----|....--  0 ruur → C
|.......|    --..--I.J..|  0 r → D
|...<...|  ---....E.-.|.|  C d
|.......|  |........LK|.|  D uur
|.......|  |..0..-....G.|  C r
-+------------.....--H..|
|.^^^^^^^^^^^...|>......|
-------------------------
```

The penultimate one goes to the left:

```---------         ------   0 l → B
|.......|     ----|....--  0 → A
|.......|    --..--I.J..|
|...<...|  ---..D.E.-.|.|
|.......|  |.....C..LK|.|
|.......|  |..0.F-....G.|
-+------------.....--H..|
|.^^^^^^^^^^^...|>......|
-------------------------
```

Which leaves the spread out positioning

```---------         ------
|.......|     ----|....--
|.......|    --..--I.J..|
|...<...|  ---..D.E.-.|.|
|.......|  |.....C..LK|.|
|.......|  |.BA.F-....G.|
-+------------.....--H..|
|.^^^^^^^^^^^...|>......|
-------------------------
```

### Conquer

Now the hole removal can finally begin by pushing the boulders alphabetically:

```---------         ------   A ddll*
|.......|     ----|....--  B rddl l*
|.......|    --..--I.J..|  C llld dlll*
|...<...|  ---..D.E.-.|.|  D dlll ddll ll*
|.......|  |.....C..LK|.|  E lldl lldd llll l*
|.......|  |.BA.F-....G.|  F dlld llll ll*
-+------------.....--H..|  G llll ulll ddll llll l*
|.^^^^^^^^^^^...|>......|  H ulll ulll ddll llll ll*
-------------------------  I dddl ulll ddll llll lll*
J lldd dlul lldd llll llll ll*
K u
L llll lldd llll llll lll*
```

Which leaves the level completed

```---------         ------
|.......|     ----|....--
|.......|    --..--.....|
|...<...|  ---......-K|.|
|.......|  |..........|.|
|.......|  |.....-......|
-+------------.....--...|
|...............|>......|
-------------------------
```