[Tutor] 15 puzzle

Deirdre Saoirse Moen deirdre@deirdre.net
Sat, 28 Apr 2001 22:57:56 -0700


--============_-1223598608==_ma============
Content-Type: text/plain; charset="us-ascii" ; format="flowed"

>Hi! My name is Maritza and I am trying to learn how to program with 
>the python language.  I'm interested in a computer version of the 15 
>puzzle.  I've seen how it works and used it as well, but I am 
>curious about how the program was set up.  Just to make sure that we 
>all know which puzzle I'm refering to, it is the one that you can 
>get at toy stores and is essentially a 4 x 4 matrix with the numbers 
>1-15 on tiles placed in the matrix.  There is one blank space where 
>tiles adjacent to the blank space may be moved into the blank space. 
>The object of the game is to arrange the numbers 1-15 in order. 
>They are initially scrambled, of course.  If you have this 
>program or can help me put it together, please e-mail me at 
>maritza_rodz.hotmail.com


The best way to set it up would be as a 4  x 4 matrix. That way, it's 
easy to know whether or not any given spot was "next to" the hole -- 
as only something that's up, down, left or right of the hole can move 
there.

Then, you'd swap the space and the number that was there. As Daniel 
said, it's an interesting problem and it could be designed either 
with a command-line interface or a gui one (or done as a command-line 
at first and developed into a GUI program).

-- 
_Deirdre     Stash-o-Matic: http://weirdre.com      http://deirdre.net
"I love deadlines. I like the whooshing sound they make as they fly by."
                                                          - Douglas Adams
--============_-1223598608==_ma============
Content-Type: text/html; charset="us-ascii"

<!doctype html public "-//W3C//DTD W3 HTML//EN">
<html><head><style type="text/css"><!--
blockquote, dl, ul, ol, li { padding-top: 0 ; padding-bottom: 0 }
 --></style><title>Re: [Tutor] 15 puzzle</title></head><body>
<blockquote type="cite" cite><font face="Arial" size="-1">Hi! My name
is Maritza and I am trying to learn how to program with the python
language.&nbsp; I'm interested in a computer version of the 15
puzzle.&nbsp; I've seen how it works and used it as well, but I am
curious about how the program was set up.&nbsp; Just to make sure that
we all know which puzzle I'm refering to, it is the one that you can
get at toy stores and is essentially a 4 x 4 matrix with the numbers
1-15 on tiles placed in the matrix.&nbsp; There is one blank space
where tiles adjacent to the blank space may be moved into the blank
space.&nbsp; The object of the game is to arrange the numbers 1-15 in
order.&nbsp; They are initially scrambled, of course.&nbsp; If
you&nbsp;have this program&nbsp;or can help me put it together, please
e-mail me at maritza_rodz.hotmail.com</font></blockquote>
<div><br>
<br>
</div>
<div>The best way to set it up would be as a 4&nbsp; x 4 matrix. That
way, it's easy to know whether or not any given spot was &quot;next
to&quot; the hole -- as only something that's up, down, left or right
of the hole can move there.</div>
<div><br></div>
<div>Then, you'd swap the space and the number that was there. As
Daniel said, it's an interesting problem and it could be designed
either with a command-line interface or a gui one (or done as a
command-line at first and developed into a GUI program).</div>
</body>
</html>
--============_-1223598608==_ma============--