Game+Ordered+Blocks

code format="lb" ' -- ' Game.. ' Put the numbers in order ' -- bf$	= "" call SetCSS

dim xBox(16) ' - ' Fill the boxes with numbers 1 to 15 ' - for i = 1 to 15 xBox(i)	= i next i

' --- ' Randomally select a box to be open ' The open box has the number 0 ' --- x 		= int(rnd(1)*15) + 1 xBox(x)		= 0 xBox(16)	= x

' -- ' The boxes are in order by 1 to 15 ' Here we shuffle the boxes to make ' the boxes random ' -- numShuffles	= 2 for 	i 	= 1 to 16 * numShuffles i1	= int(rnd(1)*16) + 1 i2	= int(rnd(1)*16) + 1 hold	= xBox(i1) xBox(i1)= xBox(i2) xBox(i2)= hold next i

' -- ' find the open box (0) and call it ' the openBox ' -- for i = 1 to 16 if xBox(i) = 0 then openBox = i next i

' --- ' The main loop ' --- [loop]

' ' Find the row and column of the openBox ' openRow	= int((openBox -1) / 4) + 1 openCol	= ((openBox - 1) mod 4) + 1

cls ' -- ' Number Puzzle ' Goal - place numbers in order ' -- html bf$;" " wait

' - ' Move the users selected box ' - [doMov] thisBox 	= val(EventKey$) hold		= xBox(openBox) xBox(openBox)	= xBox(thisBox) xBox(thisBox)	= hold openBox		= thisBox

' --- ' See if the numbers are in order ' If so - they are a winner ' --- youWin		= 1 for i = 1 to 15 if xBox(i) <> i then youWin = 0 next i if youWin = 1 then print "Horray! You Win" wait end if

goto [loop] wait

' ' CSS ' SUB SetCSS CSSClass "a.sBtn", "{ Border-Width:6px; Border-Color:lightGreen; Border-Style:solid; background:lightGreen; Font-Size:20pt; Font-Weight:Bold; Font-Family:Arial; color:black;Text-Decoration:None; }" END SUB code