Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.

Commit 27e5ef2

Browse files
authored
Merge pull request #101 from BartekCupial/nethack_sokoban
Port NetHack Sokoban
2 parents b6f68e6 + 18954d4 commit 27e5ef2

File tree

14 files changed

+679
-0
lines changed

14 files changed

+679
-0
lines changed

docs/envs/imgs/sokoban3b.png

168 KB
Loading

docs/envs/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,3 +111,4 @@ ported/boxoban
111111
| ----------------------------- | ------------------------- |
112112
| [MiniGrid](./ported/minigrid) | ![](./imgs/multiroom.png) |
113113
| [Boxoban](./ported/boxoban) | ![](./imgs/boxoban.png) |
114+
| [NetHack Sokoban](./ported/sokoban) | ![](./imgs/sokoban3b.png) |

docs/envs/ported/sokoban.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Sokoban
2+
3+
This family of environments is ported to MiniHack from [NetHack](https://github.com/facebookresearch/nle), levels taken directly from Sokoban minigame inside NetHack, excluding monsters and items. The goal is to push boulder's to goal locations (pits or wholes).
4+
5+
Original dat file can be seen [here](https://github.com/facebookresearch/nle/blob/main/dat/sokoban.des).
6+
and corresponding solution from [NetHack Wiki](https://nethackwiki.com/wiki/Sokoban).
7+
8+
An example of Sokoban level ported into MiniHack.
9+
10+
![](../imgs/sokoban3b.png)
11+
12+
## Reward
13+
14+
The agent receives a reward of +1 for reaching the stairs down and +0.1 for filling each pit.
15+
16+
## All Environments
17+
18+
| Name | Capability |
19+
| ----------------------- | ---------- |
20+
| `MiniHack-Sokoban1a-v0` | Planning |
21+
| `MiniHack-Sokoban1b-v0` | Planning |
22+
| `MiniHack-Sokoban2a-v0` | Planning |
23+
| `MiniHack-Sokoban2b-v0` | Planning |
24+
| `MiniHack-Sokoban3a-v0` | Planning |
25+
| `MiniHack-Sokoban3b-v0` | Planning |
26+
| `MiniHack-Sokoban4a-v0` | Planning |
27+
| `MiniHack-Sokoban4b-v0` | Planning |

minihack/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import minihack.envs.skills_freeze
2828
import minihack.envs.skills_lava
2929
import minihack.envs.skills_quest
30+
import minihack.envs.sokoban
3031

3132
__all__ = [
3233
"MiniHack",

minihack/dat/soko1a.des

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
MAZE: "mylevel", ' '
2+
FLAGS:noteleport,hardfloor,premapped,solidify
3+
GEOMETRY:center,center
4+
#12345678901234567890123456789012345678901234567890
5+
MAP
6+
------ -----
7+
|....| |...|
8+
|....----...|
9+
|...........|
10+
|..|-|.|-|..|
11+
---------|.---
12+
|......|.....|
13+
|..----|.....|
14+
--.| |.....|
15+
|.|---|.....|
16+
|...........|
17+
|..|---------
18+
----
19+
ENDMAP
20+
BRANCH:(06,04,06,04),(0,0,0,0)
21+
STAIR:(06,06),down
22+
REGION:(00,00,13,12),lit,"ordinary"
23+
NON_DIGGABLE:(00,00,13,12)
24+
NON_PASSWALL:(00,00,13,12)
25+
26+
# Boulders
27+
OBJECT:('`',"boulder"),(02,02)
28+
OBJECT:('`',"boulder"),(02,03)
29+
#
30+
OBJECT:('`',"boulder"),(10,02)
31+
OBJECT:('`',"boulder"),(09,03)
32+
OBJECT:('`',"boulder"),(10,04)
33+
#
34+
OBJECT:('`',"boulder"),(08,07)
35+
OBJECT:('`',"boulder"),(09,08)
36+
OBJECT:('`',"boulder"),(09,09)
37+
OBJECT:('`',"boulder"),(08,10)
38+
OBJECT:('`',"boulder"),(10,10)
39+
40+
# Traps
41+
TRAP:"pit",(03,06)
42+
TRAP:"pit",(04,06)
43+
TRAP:"pit",(05,06)
44+
TRAP:"pit",(02,08)
45+
TRAP:"pit",(02,09)
46+
TRAP:"pit",(04,10)
47+
TRAP:"pit",(05,10)
48+
TRAP:"pit",(06,10)
49+
TRAP:"pit",(07,10)

minihack/dat/soko1b.des

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
MAZE: "mylevel", ' '
2+
FLAGS:noteleport,hardfloor,premapped,solidify
3+
GEOMETRY:center,center
4+
#12345678901234567890123456789012345678901234567890
5+
MAP
6+
-------- ------
7+
|.|....|-|....|
8+
|.|-..........|
9+
|.||....|.....|
10+
|.||....|.....|
11+
|.|-----|.-----
12+
|.| |......|
13+
|.-----|......|
14+
|.............|
15+
|..|---|......|
16+
---- --------
17+
ENDMAP
18+
BRANCH:(03,01,03,01),(0,0,0,0)
19+
STAIR:(01,01),down
20+
REGION:(00,00,14,10),lit,"ordinary"
21+
NON_DIGGABLE:(00,00,14,10)
22+
NON_PASSWALL:(00,00,14,10)
23+
24+
# Boulders
25+
OBJECT:('`',"boulder"),(05,02)
26+
OBJECT:('`',"boulder"),(06,02)
27+
OBJECT:('`',"boulder"),(06,03)
28+
OBJECT:('`',"boulder"),(07,03)
29+
#
30+
OBJECT:('`',"boulder"),(09,05)
31+
OBJECT:('`',"boulder"),(10,03)
32+
OBJECT:('`',"boulder"),(11,02)
33+
OBJECT:('`',"boulder"),(12,03)
34+
#
35+
OBJECT:('`',"boulder"),(07,08)
36+
OBJECT:('`',"boulder"),(08,08)
37+
OBJECT:('`',"boulder"),(09,08)
38+
OBJECT:('`',"boulder"),(10,08)
39+
40+
# Traps
41+
TRAP:"pit",(01,02)
42+
TRAP:"pit",(01,03)
43+
TRAP:"pit",(01,04)
44+
TRAP:"pit",(01,05)
45+
TRAP:"pit",(01,06)
46+
TRAP:"pit",(01,07)
47+
TRAP:"pit",(03,08)
48+
TRAP:"pit",(04,08)
49+
TRAP:"pit",(05,08)
50+
TRAP:"pit",(06,08)

minihack/dat/soko2a.des

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
MAZE: "mylevel", ' '
2+
FLAGS:noteleport,premapped,solidify
3+
GEOMETRY:center,center
4+
#12345678901234567890123456789012345678901234567890
5+
MAP
6+
---- -----------
7+
-|..|------- |.........|
8+
|..........| |.........|
9+
|..-----.-.| |.........|
10+
|..|...|...| |.........|
11+
|.........-| |.........|
12+
|.......|..| |.........|
13+
|.----..--.| |.........|
14+
|........|.-- |.........|
15+
|.---.-.....------------+|
16+
|...|...-................|
17+
|.........----------------
18+
----|..|..|
19+
-------
20+
ENDMAP
21+
BRANCH:(03,01,03,01),(0,0,0,0)
22+
STAIR:(20,04),down
23+
DOOR:closed,(24,09)
24+
REGION:(00,00,25,13),lit,"ordinary"
25+
NON_DIGGABLE:(00,00,25,13)
26+
NON_PASSWALL:(00,00,25,13)
27+
28+
# Boulders
29+
OBJECT:('`',"boulder"),(02,03)
30+
OBJECT:('`',"boulder"),(08,03)
31+
OBJECT:('`',"boulder"),(09,04)
32+
OBJECT:('`',"boulder"),(02,05)
33+
OBJECT:('`',"boulder"),(04,05)
34+
OBJECT:('`',"boulder"),(09,05)
35+
OBJECT:('`',"boulder"),(02,06)
36+
OBJECT:('`',"boulder"),(05,06)
37+
OBJECT:('`',"boulder"),(06,07)
38+
OBJECT:('`',"boulder"),(03,08)
39+
OBJECT:('`',"boulder"),(07,08)
40+
OBJECT:('`',"boulder"),(05,09)
41+
OBJECT:('`',"boulder"),(10,09)
42+
OBJECT:('`',"boulder"),(07,10)
43+
OBJECT:('`',"boulder"),(10,10)
44+
OBJECT:('`',"boulder"),(03,11)
45+
46+
# Traps
47+
TRAP:"pit",(12,10)
48+
TRAP:"pit",(13,10)
49+
TRAP:"pit",(14,10)
50+
TRAP:"pit",(15,10)
51+
TRAP:"pit",(16,10)
52+
TRAP:"pit",(17,10)
53+
TRAP:"pit",(18,10)
54+
TRAP:"pit",(19,10)
55+
TRAP:"pit",(20,10)
56+
TRAP:"pit",(21,10)
57+
TRAP:"pit",(22,10)
58+
TRAP:"pit",(23,10)

minihack/dat/soko2b.des

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
MAZE: "mylevel", ' '
2+
FLAGS:noteleport,premapped,solidify
3+
GEOMETRY:center,center
4+
#12345678901234567890123456789012345678901234567890
5+
MAP
6+
----------- -----------
7+
|....|....|-- |.........|
8+
|....|......| |.........|
9+
|.........|-- |.........|
10+
|....|....| |.........|
11+
|-.--------- |.........|
12+
|....|.....| |.........|
13+
|....|.....| |.........|
14+
|..........| |.........|
15+
|....|.....|---------------+|
16+
|....|......................|
17+
-----------------------------
18+
ENDMAP
19+
BRANCH:(11,02,11,02),(0,0,0,0)
20+
STAIR:(23,04),down
21+
DOOR:closed,(27,09)
22+
REGION:(00,00,28,11),lit,"ordinary"
23+
NON_DIGGABLE:(00,00,28,11)
24+
NON_PASSWALL:(00,00,28,11)
25+
26+
# Boulders
27+
OBJECT:('`',"boulder"),(03,02)
28+
OBJECT:('`',"boulder"),(04,02)
29+
#
30+
OBJECT:('`',"boulder"),(06,02)
31+
OBJECT:('`',"boulder"),(06,03)
32+
OBJECT:('`',"boulder"),(07,02)
33+
#
34+
OBJECT:('`',"boulder"),(03,06)
35+
OBJECT:('`',"boulder"),(02,07)
36+
OBJECT:('`',"boulder"),(03,07)
37+
OBJECT:('`',"boulder"),(03,08)
38+
OBJECT:('`',"boulder"),(02,09)
39+
OBJECT:('`',"boulder"),(03,09)
40+
OBJECT:('`',"boulder"),(04,09)
41+
#
42+
OBJECT:('`',"boulder"),(06,07)
43+
OBJECT:('`',"boulder"),(06,09)
44+
OBJECT:('`',"boulder"),(08,07)
45+
OBJECT:('`',"boulder"),(08,10)
46+
OBJECT:('`',"boulder"),(09,08)
47+
OBJECT:('`',"boulder"),(09,09)
48+
OBJECT:('`',"boulder"),(10,07)
49+
OBJECT:('`',"boulder"),(10,10)
50+
51+
# Traps
52+
TRAP:"pit",(12,10)
53+
TRAP:"pit",(13,10)
54+
TRAP:"pit",(14,10)
55+
TRAP:"pit",(15,10)
56+
TRAP:"pit",(16,10)
57+
TRAP:"pit",(17,10)
58+
TRAP:"pit",(18,10)
59+
TRAP:"pit",(19,10)
60+
TRAP:"pit",(20,10)
61+
TRAP:"pit",(21,10)
62+
TRAP:"pit",(22,10)
63+
TRAP:"pit",(23,10)
64+
TRAP:"pit",(24,10)
65+
TRAP:"pit",(25,10)
66+
TRAP:"pit",(26,10)

minihack/dat/soko3a.des

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
MAZE: "mylevel", ' '
2+
FLAGS:noteleport,premapped,solidify
3+
GEOMETRY:center,center
4+
#12345678901234567890123456789012345678901234567890
5+
MAP
6+
--------------------
7+
|........|...|.....|
8+
|.....-..|.-.|.....|
9+
|..|.....|...|.....|
10+
|-.|..-..|.-.|.....|
11+
|...--.......|.....|
12+
|...|...-...-|.....|
13+
|...|..|...--|.....|
14+
|-..|..|----------+|
15+
|..................|
16+
|...|..|------------
17+
--------
18+
ENDMAP
19+
BRANCH:(06,10,06,10),(0,0,0,0)
20+
STAIR:(16,04),down
21+
DOOR:closed,(18,08)
22+
REGION:(00,00,19,11),lit,"ordinary"
23+
NON_DIGGABLE:(00,00,19,11)
24+
NON_PASSWALL:(00,00,19,11)
25+
26+
# Boulders
27+
OBJECT:('`',"boulder"),(02,02)
28+
OBJECT:('`',"boulder"),(03,02)
29+
#
30+
OBJECT:('`',"boulder"),(05,03)
31+
OBJECT:('`',"boulder"),(07,03)
32+
OBJECT:('`',"boulder"),(07,02)
33+
OBJECT:('`',"boulder"),(08,02)
34+
#
35+
OBJECT:('`',"boulder"),(10,03)
36+
OBJECT:('`',"boulder"),(11,03)
37+
#
38+
OBJECT:('`',"boulder"),(02,07)
39+
OBJECT:('`',"boulder"),(02,08)
40+
OBJECT:('`',"boulder"),(03,09)
41+
#
42+
OBJECT:('`',"boulder"),(05,07)
43+
OBJECT:('`',"boulder"),(06,06)
44+
45+
# Traps
46+
TRAP:"pit",(08,09)
47+
TRAP:"pit",(09,09)
48+
TRAP:"pit",(10,09)
49+
TRAP:"pit",(11,09)
50+
TRAP:"pit",(12,09)
51+
TRAP:"pit",(13,09)
52+
TRAP:"pit",(14,09)
53+
TRAP:"pit",(15,09)
54+
TRAP:"pit",(16,09)
55+
TRAP:"pit",(17,09)

minihack/dat/soko3b.des

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
MAZE: "mylevel", ' '
2+
FLAGS:noteleport,premapped,solidify
3+
GEOMETRY:center,center
4+
#12345678901234567890123456789012345678901234567890
5+
MAP
6+
--------
7+
--|.|....|
8+
|........|----------
9+
|.-...-..|.|.......|
10+
|...-......|.......|
11+
|.-....|...|.......|
12+
|....-.--.-|.......|
13+
|..........|.......|
14+
|.--...|...|.......|
15+
|....-.|---|.......|
16+
--|....|----------+|
17+
|................|
18+
------------------
19+
ENDMAP
20+
BRANCH:(06,11,06,11),(0,0,0,0)
21+
STAIR:(15,06),down
22+
DOOR:closed,(18,10)
23+
REGION:(00,00,19,12),lit,"ordinary"
24+
NON_DIGGABLE:(00,00,19,12)
25+
NON_PASSWALL:(00,00,19,12)
26+
27+
# Boulders
28+
OBJECT:('`',"boulder"),(04,02)
29+
OBJECT:('`',"boulder"),(04,03)
30+
OBJECT:('`',"boulder"),(05,03)
31+
OBJECT:('`',"boulder"),(07,03)
32+
OBJECT:('`',"boulder"),(08,03)
33+
OBJECT:('`',"boulder"),(02,04)
34+
OBJECT:('`',"boulder"),(03,04)
35+
OBJECT:('`',"boulder"),(05,05)
36+
OBJECT:('`',"boulder"),(06,06)
37+
OBJECT:('`',"boulder"),(09,06)
38+
OBJECT:('`',"boulder"),(03,07)
39+
OBJECT:('`',"boulder"),(04,07)
40+
OBJECT:('`',"boulder"),(07,07)
41+
OBJECT:('`',"boulder"),(06,09)
42+
OBJECT:('`',"boulder"),(05,10)
43+
OBJECT:('`',"boulder"),(05,11)
44+
45+
# Traps
46+
TRAP:"pit",(07,11)
47+
TRAP:"pit",(08,11)
48+
TRAP:"pit",(09,11)
49+
TRAP:"pit",(10,11)
50+
TRAP:"pit",(11,11)
51+
TRAP:"pit",(12,11)
52+
TRAP:"pit",(13,11)
53+
TRAP:"pit",(14,11)
54+
TRAP:"pit",(15,11)
55+
TRAP:"pit",(16,11)
56+
TRAP:"pit",(17,11)
57+

0 commit comments

Comments
 (0)