Newsgroups: comp.ai.games,comp.misc,comp.programming
Path: cantaloupe.srv.cs.cmu.edu!bb3.andrew.cmu.edu!nntp.sei.cmu.edu!news.cis.ohio-state.edu!math.ohio-state.edu!howland.reston.ans.net!nntp.coast.net!zombie.ncsc.mil!news.mathworks.com!newsfeed.internetmci.com!in3.uu.net!twinkie.agile.com!samosa.agile.com!jparker
From: jparker@samosa.agile.com (Jeff Parker)
Subject: Re: Sliding Tiles Games ?
Sender: usenet@twinkie.agile.com (News)
Message-ID: <DvGvt8.Gpu@twinkie.agile.com>
Date: Thu, 1 Aug 1996 16:15:08 GMT
References: <Pine.SUN.3.91.960730104033.14189D-100000@lune.math.tau.ac.il>
Organization: Agile Networks, Inc.
X-Newsreader: TIN [version 1.1 PL9]
Followup-To: comp.ai.games,comp.misc,comp.programming
Lines: 30
Xref: glinda.oz.cs.cmu.edu comp.ai.games:5891 comp.misc:40503 comp.programming:30269

: > I suddenly find myself in need of a technique
: > for solving those sliding tiles puzzles ... you
: > know - the ones with the picture on them which
: > gets jumbled around and then you spend hours
: > trying to solve them  ;->

This is usually called the 15 puzzle

Mertens Ron (mertero@math.tau.ac.il) wrote:
: It's realy a NPC problem 

Not at all.  Implement a priority queue.
The value of each position is a raw count
of the number of places a tile needs to move
to return "home", assuming that all other tiles
disappear (that is: do not block this tile)
  
Insert the initial position into the queue with
this weight.

While the priority queue is not empty, 
    Select the position with the least weight (closest to solved)
    Calculate all one move boards - there are at most 4.
    Each board must remember the position it came from.
    Place these new board positions into the queue.

Not all initial positions have solutions, but exactly half do.

- jeff parker
- Agile Networks
