'); hintwindow.document.writeln(''); hintwindow.document.writeln('
completed puzzle
'); hintwindow.document.writeln(''); hintwindow.document.writeln(''); hintwindow.document.close(); } // RANDOMSLIDE: // iterations: the number of times to do a single random move function randomSlide(iterations) { if (version=="no") { alert("\n\n\tYou are not using a browser that can deal with the latest JavaScript 1.1 language.\t\n\tSorry, you can't play this version of the game.\t\t\n\n"); } else { // suspend play while we do it playing=false; // count down the iterations while (iterations--) { // initially we set an invalid move because this routine // just fakes mouse clicks at randomly selected positions // and we want to select a valid move randomly from the start clickx=blankx; clicky=blanky; // choose randomly whether to fake a move in the // same row or the same column as the blank // .. note that we could have just gone on picking // completely random moves until we got a valid one, // but when we can be sensible about it, what's the point?! if (Math.random()>.5) // fake a move in the same column as the blank { // keep selecting a new X position until we get one // that is neither the blank square nor going to give // us a result the same as the previous move while ((clickx==blankx) || (clickx==prevx)) { clickx=Math.floor(Math.random()*gridwidth); } // we set the column to be the same as the blank square clicky=blanky; } else // fake a move in the same row as the blank { // keep selecing a new Y position until we get one // that is neither the blank square nor going to give // us a result the same as the previous move while ((clicky==blanky) || (clicky==prevy)) { clicky=Math.floor(Math.random()*gridheight); } // we set the row to be the same as the blank square clickx=blankx; } // set variables so that when we do another random move we can // make sure that we don't end up just shuffling the same pieces // back and forth continually prevx=blankx; prevy=blanky; // we picked our place, let's fake the move - the true value is // passed so that our slide function knows it is being faked slide(clickx,clicky,true); } // check to see if we solved it by shuffling checkSolved(); // resume (or start) play as we have finished shuffling playing=true; } } // CHECKSOLVED: function checkSolved() { // This routine works by virtue of the fact that we have named // the images using the convention atXY (where X and Y are the numbers // of the row and column so that at00 is the top left square position) // and that the actual graphics are sourced from images with the name // blockXY (where X and Y are the numbers of the row and column where // the image is originally found). Therefore the puzzle is solved when // all atXY positions are filled by the corresponding blockXY graphic. // For example, if position at00 held block30.gif then we know the puzzle // has not been solved. // start off by assuming the puzzle has been solved solved=true; // sweep down the rows of the board.. for(y=0;y 12) start=block.lastIndexOf(".")-2; // work out the name where this image starts out name2="at"+block.substring(start,start+2); // if this image didn't start out here, we've not solved the puzzle if (name1!=name2) solved=false; } } // got through all the positions without declaring that the // puzzled had not been solved, therefore by a simple process // of elimination.. we've solved it! if (solved) { // alert us to the fact we completed the puzzle and tell us // how many moves were counted - JavaScript is held at this // statement until the OK box is clicked in the alert window replace="at"+blankx+blanky; document.images[replace].src=gfxdir+"/block"+blankx+blanky+"."+gfxtype; alert("\n\n\tCONGRATULATIONS!\n\tYou solved the slide puzzle in "+moves+" moves.\n\n\tPress the OK button, then shuffle the pieces if you want to try again.\t\t\n\n"); // reset the move counter to zero and indicate that we've finished playing moves=0; playing=false; } } // DISPLAYGRID: function displaygrid() { // This makes sure that only browsers that can do the game // will actually see the grid. Others get a message saying // that they can't play - could suggest an alternative. var piece=""; document.writeln('
'); document.writeln(''); document.writeln(''); document.writeln(''); document.writeln(''); document.write(' '); document.writeln(' '); document.writeln(''); document.writeln('
GAME CODE COPYRIGHT PORT80
FIND OUT HOW TO MAKE YOUR OWN PUZZLE
'); document.writeln(' '); document.writeln('

'); // sweep down the rows of the board.. for(y=0;y'); // ..and across the columns in the current row for(x=0;x(',x,',',y,')'); } else { document.writeln(' '); } } document.writeln(' '); } document.writeln('
(',x,',',y,')
'); if (hintbutton=="yes") { document.write(''); } document.writeln('
'); document.writeln(''); } // -->

Click for Home

   
 





















Readers Comments

your E-mail Address
Subscribe
Un-Subscribe

Today's Topics
 

Classified Adverts
 


Copyright © New Rider 2003  
All material on the Newrider.com website is copyrighted. Express written permission must be obtained to use anything you find here.


 Location:   Other Bits | Screen Fun  

Picture Puzzle

For a bit of entertainment - here's our offering of the popular slide type puzzle. All you have to do is click on shuffle and then move the pieces back to reform the picture. Clicking on a piece next to the blank hole will move that piece into the hole.

You'll need a javascript enabled browser to play this.



Note: Once you've downloaded this page into your browser you can continue to play it off-line.



Top of Page

     Other Bits Index

Next Page
 
 
 
 
Horses for Sale
Name: Pagan
Height: 16.1
Details: Forward Going Gentleman, 100% In All Ways Has Jumped Up To 5...
View Details