G
Guest
Guest
Archived from groups: comp.ai,comp.ai.games (More info?)
Hi,
I'm trying to solve the block puzzle with python.
For those of You who don't know it, here is a short description:
# a starting state of a 8-puzzle could look like the following:
# where X is the empty space
# You can move any neighbour (x-axis or y-axis) to the empty space
# ------------
# | 7 2 4 |
# | |
# | 5 X 6 |
# | |
# | 8 3 1 |
# ------------
# the goal is to reach this state:
# ------------
# | X 1 2 |
# | |
# | 3 4 5 |
# | |
# | 6 7 8 |
# ------------
Now my question is about the design. At the moment I have three
classes: Solvepuzzleagent, puzzle and binarytree.
1) Should the puzzle be extended by a tree or should there be a
seperate tree containing the states?
2) So if I have the class puzzle should I create a seperate tree where
each node is a puzzle object in a different state?
3) Which class should take care of the expansion of the fringe? The
puzzle class or the agent?
4) How do I take care of repeating states?
Thanks.
[ comp.ai is moderated. To submit, just post and be patient, or if ]
[ that fails mail your article to <comp-ai@moderators.isc.org>, and ]
[ ask your news administrator to fix the problems with your system. ]
Hi,
I'm trying to solve the block puzzle with python.
For those of You who don't know it, here is a short description:
# a starting state of a 8-puzzle could look like the following:
# where X is the empty space
# You can move any neighbour (x-axis or y-axis) to the empty space
# ------------
# | 7 2 4 |
# | |
# | 5 X 6 |
# | |
# | 8 3 1 |
# ------------
# the goal is to reach this state:
# ------------
# | X 1 2 |
# | |
# | 3 4 5 |
# | |
# | 6 7 8 |
# ------------
Now my question is about the design. At the moment I have three
classes: Solvepuzzleagent, puzzle and binarytree.
1) Should the puzzle be extended by a tree or should there be a
seperate tree containing the states?
2) So if I have the class puzzle should I create a seperate tree where
each node is a puzzle object in a different state?
3) Which class should take care of the expansion of the fringe? The
puzzle class or the agent?
4) How do I take care of repeating states?
Thanks.
[ comp.ai is moderated. To submit, just post and be patient, or if ]
[ that fails mail your article to <comp-ai@moderators.isc.org>, and ]
[ ask your news administrator to fix the problems with your system. ]