← Complete problem index

PROJECT EULER · #0244

Sliders

Statement only · SolvedOriginal problem ↗

You probably know the game Fifteen Puzzle. Here, instead of numbered tiles, we have seven red tiles and eight blue tiles.

A move is denoted by the uppercase initial of the direction (Left, Right, Up, Down) in which the tile is slid, e.g. starting from configuration (S), by the sequence LULUR we reach the configuration (E):

(S)0244_start.gif, (E)0244_example.gif

For each path, its checksum is calculated by (pseudocode):

checksum=0checksum=(checksum×243+m1)mod100000007checksum=(checksum×243+m2)mod100000007checksum=(checksum×243+mn)mod100000007 where mk is the ASCII value of the kth letter in the move sequence and the ASCII values for the moves are:
L76
R82
U85
D68

For the sequence LULUR given above, the checksum would be 19761398.

Now, starting from configuration (S), find all shortest ways to reach configuration (T).

(S)0244_start.gif, (T)0244_target.gif

What is the sum of all checksums for the paths having the minimal length?

Write-up coming later

The complete problem is available here. An approach, code, and answer will be added later.