Code

Description

This exercise is inspired by the eponymous sliding block game: Rush Hour.

Here is the description of the exercise:

  • There is an n × n grid
  • A set of 2 × 1 cars are positioned on the grid. They are oriented horizontally or vertically. Each car can move forward or backward in the direction of the car if another car is not blocking the car. A move is shifting any one car by a single block
  • A special red car, which moves horizontally. The goal is to get the red car to the rightmost end of its lane within a given number of moves (referred to as “limit”)
  • There are some 1 × 1 mines on the grid. A car cannot drive over a mine.
  • Cars cannot collide with each other

Contributors

Advait Padhye
Kartik Gokhale

Image credits