tjerkok / Rush_Hour

0 stars 0 forks source link

Early solution detection #20

Closed tjerkok closed 3 years ago

tjerkok commented 3 years ago

For each node that creates child nodes, only one node can be a solved configuration, the largest movement of the target car, because the only way to get a solved configuration from an unsolved one is to move the target car as far right as possible. Each node taken from the queue checks if targetCar.x + moveRange.max = board.size − targetCar.size is true, where moveRange is the movement range of the target car as described in Chapter 3. If the statement is true, the current node plus the move (0, moveRange.max) is and optimal solution. The solver stops the solving processes and returns this solution.