# Sokoban Level 4a

Sokoban Level 4a is one of two possible maps for the last level of Sokoban in NetHack, and is among the various possible maps for that level in variants of NetHack. Behind the holes is a treasure zoo with three doors - inside one of the doors is the branch prize, which has an equal chance of being a bag of holding or an amulet of reflection. There are 18 boulders and 16 holes, leaving 2 spare boulders.

The following information pertains to an upcoming version (NetHack 3.7.0). If this version is now released, please verify that it is still accurate, then update the page to incorporate this information.

Both prizes are no longer equally likely for each floor. Instead, this version has a 75% chance for a bag of holding, and 4b has a 75% chance for an amulet of reflection. Also, the level may be vertically reflected.
```0 boulder
^ hole
@ starting position/downstairs
< upstairs
```
```--------------------------
|@......^^^^^^^^^^^^^^^^.|
|.......----------------.|
-------.------         |.|
|...........|         |.|
|.0.0.0.0.0.|         |.|
--------.----|         |.|
|...0.0..0.0.|         |.|
|...0........|         |.|
-----.--------   ------|.|
|..0.0.0...|  --|.....|.|
|.....0....|  |.+.....|.|
|.0.0...0.--  |-|.....|.|
-------.----   |.+.....+.|
|..0.....|     |-|.....|--
|........|     |.+.....|
|...------     --|.....|
-----            -------
```

## Strategy

The following solution solves the level without putting any boulders in an immobile position. You can watch this solution as a ttyrec video or a YouTube video. Faster solutions which do not necessarily leave every boulder free might exist.

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 Nddrr* means move boulder N two times down and two times to the right into a hole.

Store some boulders of the 3rd room in the 4th and make some way:

```-------------------------- K l
|@......^^^^^^^^^^^^^^^^.| N rrr
|.......----------------.| R rrr
-------.------         |.| P rrdd dlll lur
|...........|         |.| F ll
|.A.B.C.D.E.|         |.| J rddd drrd ddll lllu
--------.----|         |.|
|...F.G..H.I.|         |.|
|...J........|         |.|
-----.--------   ------|.|
|..K.L.M...|  --|.....|.|
|.....N....|  |.+.....|.|
|.O.P...Q.--  |-|.....|.|
-------.----   |.+.....+.|
|..R.....|     |-|.....|--
|........|     |.+.....|
|...------     --|.....|
-----            -------
```

Push G and H out of the way so you can move some of the boulders of the 1st room to the 3rd and 4th room:

```-------------------------- G ll
|>......^^^^^^^^^^^^^^^^.| H ll
|.......----------------.| D lddd llld dddr
-------.------         |.| C rddd llld dd
|...........|         |.|
|.A.B.C.D.E.|         |.|
--------.----|         |.|
|.F...G..H.I.|         |.|
|............|         |.|
-----.--------   ------|.|
|.K..L.M...|  --|.....|.|
|........N.|  |.+.....|.|
|.O.....Q.--  |-|.....|.|
-------.----   |.+.....+.|
|.J.P.R..|     |-|.....|--
|.@......|     |.+.....|
|...------     --|.....|
-----            -------
```

It is also possible to push D into the 4th room under J and move C to where D is now if you want some more leeway to move boulders around. Now everything is set up to start filling holes. Cleanup most of rooms 2 and 3:

```-------------------------- H ruuu luuu r*
|>......^^^^^^^^^^^^^^^^.| G rrrr uuul uuur r*
|.......----------------.| F rrrr rruu uluu urrr*
-------.------         |.| I lllu uulu uurr rr*
|...........|         |.| C uuuu rrru uulu uurr rrr*
|.A.B.....E.|         |.| K rruu urrr uuul uuur rrrr r*
--------.----|         |.| L luuu rrru uulu uurr rrrr r*
|.F.G..H...I.|         |.| M lllu uurr ruuu luuu rrrr rrrr*
|............|         |.| N llll luuu urrr uuul uuur rrrr rrrr*
-----.--------   ------|.|
|.K.@L.M...|  --|.....|.|
|...C....N.|  |.+.....|.|
|.O..D..Q.--  |-|.....|.|
-------.----   |.+.....+.|
|.J.P.R..|     |-|.....|--
|........|     |.+.....|
|...------     --|.....|
-----            -------
```

Now there are only a few boulders left with a lot of space. The boulders in room 4 can be cleared directly, the boulders in room 1 and 3 should first be moved through room 3 and 4 respectively:

```-------------------------- R ruuu ullu uurr ruuu luuu rrrr rrrr rr*
|>.............@.^^^^^^^.| P rrru uuul luuu rrru uulu uurr rrrr rrrr r*
|.......----------------.| J rrrr ruuu ullu uurr ruuu luuu rrrr rrrr rrrr*
-------.------         |.| D rddd llll lurr rrru uuul luuu rrru uulu uurr rrrr rrrr rrr*
|...........|         |.| B rrrd ddll lddd uuuu rrru uulu uurr rrrr rrrr rrrr*
|.A.B.....E.|         |.| A rrrr rddd llld dduu uurr ruuu luuu rrrr rrrr rrrr rrr*
--------.----|         |.| E llld ddll lddd uuuu rrru uulu uurr rrrr rrrr rrrr rr*
|............|         |.|
|............|         |.|
-----.--------   ------|.|
|..........|  --|.....|.|
|..........|  |.+.....|.|
|.O..D..Q.--  |-|.....|.|
-------.----   |.+.....+.|
|.J.P.R..|     |-|.....|--
|........|     |.+.....|
|...------     --|.....|
-----            -------
```

In the large room behind the door is a treasure zoo. Behind one of the three doors in the zoo is a square with the prize item atop a burnt "Elbereth" and a cursed scroll of scare monster. Also remember to check under the boulders O and Q for possible usable items.

```--------------------------
|>.......................|
|.......----------------.|
-------.------         |.|
|...........|         |.|
|...........|         |.|
--------.----|         |.|
|............|         |.|
|............|         |.|
-----.--------   ------|.|
|..........|  --|.....|.|
|..........|  |.+.....|.|
|.O.....Q.--  |-|.....|.|
-------.----   |.+.....+@|
|........|     |-|.....|--
|........|     |.+.....|
|...------     --|.....|
-----            -------
```

## History

The level originates from Level 23 of the 1984 Thinking Rabbit game Sokoban 2, with the storage area beyond the holes added on.

In NetHack 3.4.3 and earlier versions, including some variants based on these versions, the prize is always a bag of holding, with no cursed scroll of scare monster underneath it. As of NetHack 3.6.0, the cursed scroll of scare monster is added, and there is a 50% chance for the prize to be either a bag of holding or an amulet of reflection.

## Variants

### UnNetHack

In UnNetHack, this level may be flipped horizontally or vertically like all Sokoban levels. The prize is also changed to a choice from one of the following: a bag of holding, a cloak (of magic resistance or displacement) and an amulet (of reflection, life saving or ESP).

### EvilHack

In EvilHack, the choice is between a prize tool (a bag of holding or a magic marker), a prize armor (a helm of speed or a pair of gauntlets of protection), or a prize amulet (an amulet of reflection or magic resistance). As soon as one of the doors is opened, the others will seal: some form of object detection is recommended if you are aiming for a specific reward.

### Hack'EM

In Hack'EM, this level is named "Left Holding the Bag". Like EvilHack, the choice is between a prize tool (a bag of holding or a magic marker), a prize armor (a helm of speed or a pair of gauntlets of protection), or a prize amulet (an amulet of reflection or magic resistance). As soon as one of the doors is opened, the others will seal: as in EvilHack, a form of detecting the prizes is recommended if you are aiming for a specific reward.