# Sokoban Level 4d

Sokoban Level 4d is one of the new possible maps for the final level of Sokoban in SLASH'EM, UnNetHack, EvilHack, SlashTHEM, SpliceHack-Rewrite, and Hack'EM. In Hack'EM, the level is named "Work For It". It has 16 boulders and 16 holes.

Behind the holes is a treasure zoo and set of closets - as is standard for the final Sokoban level, the prize(s) sits atop a burnt engraving of "Elbereth", as well as a cursed scroll of scare monster depending on the variant.

The prizes and layout vary with each variant:

------------
|.+......+.|
|-|......|--------
|.+......+^^^^^..|
|-|......|-----..|
|.+......+.|  |^--
|-------------|^|
|.....|...|...|^|
|.00..0...0.0.|^|
|..0.------.|.|^|
|.00.|>..|..0.|^|
|....|..0....-|^|
-----|0--..---|^|
|...|.0...+..#^|
|....0...-|..#^|
|-.----.---##-^|
|..0...00......|
|...|...-----..|
---------   ----

## 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'.

All boulders are 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.

Arrange the boulders in the middle and lower areas so they can be pushed into holes later

```------------       J rrr
|.+......+.|       M lll
|-|......|-------- L rru
|.+......+^^^^^..| M rrrr
|-|......|-----..| N rrr
|.+......+.|  |^-- O u
|-------------|^|
|.....|...|...|^|
|.AB..C...D.E.|^|
|..F.------.|.|^|
|.GH.|@..|..I.|^|
|....|..J....-|^|
-----|K--..---|^|
|...|.L...+..#^|
|....M...-|..#^|
|-.----.---##-^|
|..N...OP......|
|...|...-----..|
---------   ----
```

Check the room with the locked door for magic wands before filling in the next six holes:

```------------       P rrrr rru*
|.+......+.|       N rrrr rrrr uu*
|-|......|-------- O d___ ____ __ rrrr rrru uu*
|.+......+^^^^^..| M rdd_ ____ __ rrrr rrru uuu*
|-|......|-----..| K ddrr dd__ __ rrrr rrru uuuu*
|.+......+.|  |^-- L dlll drrd d_ rrrr rrru uuuu u*
|-------------|^|
|.....|...|...|^|
|.AB..C...D.E.|^|
|..F.------.|.|^|
|.GH.|>..|..I.|^|
|....|.....J.-|^|
-----|K--L.---|^|
|...|.....+..#^|
|.....M..-|..#^|
|-.----O---##-^|
|.....N@P......|
|...|...-----..|
---------   ----
```

The next four boulders fill holes in order of their distance from them:

```------------       I l
|.+......+.|       J ____ ____ ___ llll lddd rrdd rrrr rrru uuuu uu*
|-|......|-------- I d___ ____ ___ llll lddd rrdd rrrr rrru uuuu uuu*
|.+......+^^^^^..| E lddd ____ ___ llll lddd rrdd rrrr rrru uuuu uuuu*
|-|......|-----..| D llrr rrld dd_ llll lddd rrdd rrrr rrru uuuu uuuu u*
|.+......+.|  |^--
|-------------|^|
|.....|...|...|^|
|.AB..C...D.E.|^|
|..F.------.|.|^|
|.GH.|>..|..I.|.|
|....|.....J.-|@|
-----|.--..---|.|
|...|........#.|
|........-|..#.|
|-.----.---##-.|
|..............|
|...|...-----..|
---------   ----
```

The last six boulders need to be arranged so they don't get each other stuck:

```------------       C ll
|.+......+.|       F r
|-|......|-------- B d
|.+......+^^^^^..|
|-|......|-----..|
|.+......+.|  |^--
|-------------|.|
|.....|...|...|@|
|.AB..C.......|.|
|..F.------.|.|.|
|.GH.|>..|....|.|
|....|.......-|.|
-----|.--..---|.|
|...|........#.|
|........-|..#.|
|-.----.---##-.|
|..............|
|...|...-----..|
---------   ----
```

Now the final holes can be filled:

```------------       C ____ _ rrrr rrrr lddd llll lddd rrdd rrrr rrru uuuu uuuu uu*
|.+......+.|       A rr__ _ rrrr rrrr lddd llll lddd rrdd rrrr rrru uuuu uuuu uuuu l*
|-|......|-------- G uurr _ rrrr rrrr lddd llll lddd rrdd rrrr rrru uuuu uuuu uuuu ll*
|.+......+^^^^^..| F u___ _ rrrr rrrr lddd llll lddd rrdd rrrr rrru uuuu uuuu uuuu lll*
|-|......|-----..| H ruu_ _ rrrr rrrr lddd llll lddd rrdd rrrr rrru uuuu uuuu uuuu llll*
|.+......+.|  |^-- B ur__ _ rrrr rrrr lddd llll lddd rrdd rrrr rrru uuuu uuuu uuuu llll l*
|-------------|.|
|.....|...|...|.|
|.A@C.........|.|
|..BF------.|.|.|
|.GH.|>..|....|.|
|....|.......-|.|
-----|.--..---|.|
|...|........#.|
|........-|..#.|
|-.----.---##-.|
|..............|
|...|...-----..|
---------   ----
```

The level is now complete, allowing you to enter the zoo and fight your way towards the prize:

```------------
|.+......+.|
|-|......|--------
|.+......+.@.....|
|-|......|-----..|
|.+......+.|  |.--
|-------------|.|
|.....|...|...|.|
|.............|.|
|....------.|.|.|
|....|>..|....|.|
|....|.......-|.|
-----|.--..---|.|
|...|........#.|
|........-|..#.|
|-.----.---##-.|
|..............|
|...|...-----..|
---------   ----
```