Overview of Gym-Sokoban
The gym-sokoban project is a delightful foray into the world of Sokoban, a classic Japanese puzzle video game. In this game, a player assumes the role of a warehouse keeper (Sokoban) tasked with pushing boxes to target locations in a warehouse room. Unlike simple puzzles, Sokoban introduces the challenging possibility of making irreversible mistakes, which particularly tests Reinforcement Learning (RL) algorithms that struggle with forward thinking.
The version of Sokoban implemented in gym-sokoban draws inspiration from a DeepMind paper titled "Imagination Augmented Agents for Deep Reinforcement Learning." The game features randomly generated rooms, thereby reducing the risk of neural networks overfitting on specific room configurations. This randomness makes gym-sokoban an ideal testing ground for RL algorithms.
Installation
For those eager to dive in, gym-sokoban is readily accessible. It can be installed via pip with the simple command:
pip install gym-sokoban
Alternatively, the repository can be cloned directly from GitHub for those who prefer to explore the source code:
git clone [email protected]:mpSchrader/gym-sokoban.git
cd gym-sokoban
pip install -e .
Game Environment
Room Elements
Each room in gym-sokoban is a combination of walls, floors, boxes, box targets, and a player. These elements can exist in various states, depending on their position in relation to box targets.
- Walls: Static obstacles.
- Floor: Empty navigation space.
- Box and Box Targets: Boxes can be on or off their respective targets.
- Player: Can be on or off a tarbox target.
Actions
In gym-sokoban, players can execute a variety of actions:
- No Operation (0): Does nothing and keeps the state unchanged.
- Push (1-4): Moves a box if the path is clear (up, down, left, right).
- Move (5-8): Simply moves the player if the path is clear (up, down, left, right).
Rewards
Players earn rewards based on their performance:
- -0.1 for every step taken.
- 1.0 for pushing a box onto a target.
- -1.0 for pushing a box off a target.
- 10.0 for placing all boxes correctly.
Level Generation
- Topology Generation involves crafting a random arrangement of walls and floors.
- Placement of Elements strategically places players and box targets in the room.
- Reverse Playing ensures room solvability by allowing box movement and tracking scores through a depth-first search.
Configuration and Variations
Gym-sokoban is highly customizable with various room sizes, box numbers, and rendering options. For example, the visualization modes range from detailed 2D graphics to simple pixel representations called TinyWorld.
Variations include:
- Fixed Targets: Boxes must be placed on matching colored targets.
- Multiple Player: Two players alternate turns.
- Push&Pull: Players can both push and pull, eliminating irreversible errors.
- Boxoban: Utilizes pre-generated puzzles by DeepMind.
Get Involved
Connect
Interested individuals are welcome to connect with the developer via LinkedIn or the project GitHub issues.
Contribute
Developers can contribute to gym-sokoban by forking the repository and implementing new features or reporting issues for assistance. The project invites creativity and collaboration, enhancing its depth and functionality through community efforts.
In conclusion, gym-sokoban offers an engaging simulation environment, ideal for testing and developing sophisticated reinforcement learning techniques while enjoying the timeless challenge of Sokoban puzzles.