Back
Close

Lunar Lockout

Statement

 Goal

Lunar Lockout is a game edited by Binary Arts in 1999.
--------------------------------------------------------------------------------
The object : To maneuver the Red Spacepod (X) assisted by the Helper-Bots (A, B, C, ...), until it lands on the Emergency Entry Port at the center of the Mothership's Landing Grid.

The Rules :
1 - Spacepod and Helper-Bots (both may be described as tokens below) travel between the grid lines, and can only move up (U), left (L), down (D) and right (R). No diagonal movement is allowed.
2 - You can only move a token on the grid if its movement can be blocked by a Helper-Bot or the Spacepod. Without this block, the Spacepod or Helper-Bot will jet off the Landing Grid into space --- forever !
3 - A move is complete when a moving token lands on the grid square next to the blocking token (the blocking token acts like your brakes).
4 - The Spacepod must jet over the Emergency Entry Port unless a blocking token stops the Spacepod from moving further.

Note :
- If there are several solutions, the shortest one is given.
- If there are still several solutions, we will give the first one in alphabetical order.

Example :
Input :
.....
A.C..
..D..
..X..
B....

Bot B move Up : write BU
.....
A.C..
B.D..
..X..
.....

Bot D move Left : write DL
.....
A.C..
BD...
..X..
.....

Pod X move Up : write XU
.....
A.C..
BDX..
.....
.....

You WIN !!

Output :
BU DL XU

.....
A.C..
BDX..
.....
.....


Example in video : https://www.youtube.com/watch?v=KXGcwYqiSLM
Input
5 lines The grid
Output
Line 1 : The list of moves as shown in the example
Line 2 : A blank line
5 lines : The grid giving the final position of the Helper-Bots and the Spacepod
Constraints
The number of Helper-Bots varies between 1 and 5 (A to E).
Example
Input
.....
A.D..
.C...
..X..
B....
Output
XU

.....
A.D..
.CX..
.....
B....

Tags
BFS

Difficulty
Medium

Test cases
One move Test
Input
..... A.D.. .C... ..X.. B....
Output
XU ..... A.D.. .CX.. ..... B....

One move Validator
Input
..X.. ....B ..... ..A.. .....
Output
XD ..... ....B ..X.. ..A.. .....

A little more movement Test
Input
...B. ..... X.... ....C A....
Output
AU AR BD XR ..... ..... ..XB. ...AC .....

A little more movement Validator
Input
..X.. ..... ..... ..... A.B.C
Output
AR BU CL BD XD ..... ..... ..X.. ..B.. .AC..

A few more moves Test
Input
.A... ....C X.... ..... ...BD
Output
DU DL DU DR BU XR .A... ...DC ..XB. ..... .....

A few more moves Validator
Input
..C.. ..... ...X. AB... ...DE
Output
XD BR AR BU XL XU ..C.. ..B.. ..X.. .A... ...DE

Many more movements Test
Input
A.D.. B.... ....E C..X. .....
Output
AR XL AD AR CU CR CU BR XU XR ..D.. .BC.. ..XAE ..... .....

Many more movements Validator
Input
.C..D .X... A.... ..... B...E
Output
BR CR CD EU XR CU BU CL XD XL ....D ....E ACX.. ...B. .....

The maximum of movements Test
Input
AD..E B.... ..... ..... C...X
Output
BD CR DR DD DL BU XU BR BD BL EL DU XL XD AE... .D... ..X.. ..B.. ...C.

The maximum of movements Validator
Input
A.B.. ....D ..... ...C. .X..E
Output
AR AD CL CU XR EU DL DD DL DU DR XU XL XU ..B.. ..C.. ..XDE .A... .....

Example of the statement Test
Input
..... A.C.. ..D.. ..X.. B....
Output
BU DL XU ..... A.C.. BDX.. ..... .....

Validator 6 Validator
Input
..... ..B.C ..A.. ....D ..X..
Output
AD AR XU ..... ..B.C ..X.. ...AD .....

Solution language

Solution

Stub generator input