- You drive the red car in front of the exit (x==4)
This puzzle can be solved using the following concepts. Practice using these concepts and improve your skills.
There is a 6x6 grid surrounded by walls, except an exit on the right of the 3rd line.
You have to drive the red car to the exit, but there are other vehicles that obstruct the path.
Vehicles are given by their id, top-left coordinates, length and axis (H/V).
- The exit is always on 3rd line (y==2), on the right.
- The ID of the red car is always 0, on the 3rd line (y==2) and the car is always 2 cells long and horizontal.
- The IDs of the other vehicles are always >0, and they are 2 or 3 cells long.
- The other vehicles can't be both horizontal and on 3rd line.
You indicate moves by the id of the vehicle, followed by the direction UP / DOWN / LEFT / RIGHT.
You win the game when the red car is in front of the exit (x==4).
- You do not respond in time.
- You output an unrecognized id.
- You output an unrecognized direction.
- You exceed the number of turns allowed
🐞 Debugging tips
- Append text after any command and that text will appear above the grid.
- Hover over a car to see information about it.
Line 1: The number n of cars
n lines: The cars represented by 4 integers id, x, y, length and one string axis
0<id<16 for other vehicles
axis='H' or 'V'
Max response time in the 1st turn : 5 seconds
Max response time in the other turns : 100 ms
Max turns : 100
Input for 1st turn :
0 1 2 2 H
3 4 2 2 V
13 0 4 3 H
These inputs mean :
- there are 3 vehicles
- the vehicle with id 0 starts at x=1, y=2, is 2 cells long and is horizontal
- the vehicle with id 3 starts at x=4, y=2, is 2 cells long and is vertical
- the vehicle with id 13 starts at x=0, y=4, is 3 cells long and is horizontal
Output for 1st turn :
0 RIGHT (red car moves to right)
Input for 2nd turn :
0 2 2 2 H (after moving right)
3 4 2 2 V
13 0 4 3 H
Mitch and the beach
Mitch wants to reach the beach.
Mitch owns a beautiful red car.
Mitch loves to pose with his red car on the beach.
But ... Oh No ! Mitch is stuck in city traffic.
You have to help Mitch to exit the city, so that Mitch can reach the beach.
A higher resolution is required to access the IDE