Sujet : Re: A Tile Moving Puzzle
De : carlgnews (at) *nospam* microprizes.com (Carl G.)
Groupes : rec.puzzlesDate : 28. Sep 2024, 19:22:18
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vd9hgs$1bphu$1@dont-email.me>
References : 1 2
User-Agent : Mozilla Thunderbird
On 9/27/2024 9:56 PM, HenHanna wrote:
On Thu, 26 Sep 2024 21:47:07 +0000, Carl G. wrote:
The goal of tile-moving puzzles are to change one pattern into another
by moving square tiles (or other markers) around on a grid. When a tile
is moved, it must be moved to an empty cell where at least two of its
edges will touch the edges of orthogonally adjacent tiles.
>
Below is a puzzle on a 4 by 4 grid (view with a fixed-width font). "#"
represents a tile and " " represents an empty cell.
>
From pattern:
>
#
##
##
#
>
To pattern:
>
#
##
##
#
>
Each move can be recorded as four numbers. The first two numbers are the
coordinates of the moved tile's starting location (row number and column
number). The second two numbers are the coordinates of the tile's ending
location. For example, (2,2-3,4) means move the tile at (2,2) to (3,4),
and when applied this puzzle's initial state would result in:
>
#
#
###
#
>
The moves required for the sample puzzle is less than 20.
#
.##
.##
...#
i see... Went from the above to below:
#
..#
.##O ------- where O is the move- destination
...#
This is easier to represent than Dudeney's 6 coins puzzle.
i wonder if it's possible to solve this with a Python program that does
DFS
It's certainly solvable with Python. A depth-first search (DFS) is one way. It might be more difficult using a language that does not support recursive calls (like FORTRAN IV), but one can use a stack instead. I believe I used a version of Basic to confirm my "best" solution, but I can't find the source code. I found some easier puzzles in my files. Below is one that takes less than ten moves. It's not hard to solve without a computer.
####
...#
...#
...#
#...
#...
#...
####
-- Carl G.-- This email has been checked for viruses by AVG antivirus software.www.avg.com