Back
Close
  • 78

Learning Opportunities

This puzzle can be solved using the following concepts. Practice using these concepts and improve your skills.

Statement

  The Goal

Place all boxes on their target cells.

  Rules

You have one unit which you can move around on the map. You can push boxes by walking into them. This will push the box in the same direction as you are moving in. The field where you push the box to must be free, it is not possible to move two or more boxes at once.
You are given target cells where you have to place the boxes.

  Expert Rules

The source code can be found here: https://github.com/eulerscheZahl/Sokoban

  Game Input

Initial input

Line 1: width height boxCount, the width and height of the map and the number of boxes

next height lines: a string of width characters, that can be:

  • . for an empty cell
  • # for a wall
  • * for a target cell
Input per turn

Line 1: pusherX pusherY, the position of your unit

next boxCount lines: boxX boxY, the position of each box

Output
A single character indicating your movement direction: U to move up, D to move down, R to move right, L to move left.
Constraints
7width11
7height11
3boxCount5

Allotted response time to output is ≤ 10 seconds for the first turn, 50 ms for later turns.
Sprites:
https://opengameart.org/content/sokoban-100-tiles

Levels:
https://www.sourcecode.se/sokoban/levels

A higher resolution is required to access the IDE