The Goal

Help the cars to reach the target tiles.

  Rules

You are given a board with solid ground tiles, void cells, 2-5 cars and floating platforms. You can navigate the cars as well as the platforms. The cars will always move by exactly one cell at a time. The platforms move, until they hit a solid cell or another platform. Platforms can only move in certain directions. A platform can only be moved, while a car is on it.

  Advanced Details

It is possible to move a platform out of the game, into orbit. Every map is solvable without doing so, but for some maps such an action can make it easier to solve.
You can see the game's source code on https://github.com/eulerscheZahl/SpaceJam.
Victory Conditions
  • The cars reach their target cells
Loss Conditions
  • A car gets lost in space by moving on a void cell or by sending a platform with the car on it into orbit
  • You don't reach all the target cells within 200 turns.
  • You do not respond in time or output an unrecognized command.

  Initial input

Line 1: width: the width of the board

Line 2: height: the height of the board

Next height lines: the grid. A cell can be:

  • # for a void cell
  • . for a ground cell
  • 0, 1, ... for the target cells (corresponding to the ID of the car)

Turn input

Line 1: entityCount, the number of entities in the game

Next entityCount lines: id, x, y, directions
directions is either CAR for the car, or a combination of the letters U, D, R and L.
There are 7 different types of platforms: U, D, R, L, UD, RL, UDRL.

Output
A single line containing an id and direction (U, D, R or L) to indicate what and where to move.
Constraints
2entityCount10
width = 19
height = 10
Response time ≤ 1000 ms for the first turn, 50 ms for every turn after
200 turns to reach the target