home *** CD-ROM | disk | FTP | other *** search
/ Hand Held Organizer Toolkit / walnutcreekcdrom-handheldorganizertoolkit-march1998.iso / PalmPilot / games / fliper.txt < prev    next >
Text File  |  1997-12-30  |  1KB  |  85 lines

  1. # FLIPER
  2. # Freeware
  3. # By Alex Garza (02/16/97)
  4.  
  5. # e-mail: agarza@mail.giga.com
  6.  
  7.  
  8. #  Please wait while program is
  9. #                 being loded...
  10.  
  11.  
  12. new
  13.  
  14. # initialize
  15. 10 dim a(36)
  16. 20 for i=0 to 35 : a(i)=1 : next i
  17. 40 input "Solvable in how many moves?",m
  18. 50 if m<1 or m>100 then 40
  19. 60 for i=1 to m
  20. 70 j=rnd(36)
  21. 80 gosub 900
  22. 90 next i
  23. 95 p=0
  24.  
  25. #main loop
  26. # draw grid
  27. 100 o=fn 42
  28. 110 for i=20 to 140 step 20
  29. 120 grline i,20,i,140
  30. 130 grline 20,i,140,i
  31. 140 next i
  32.  
  33. #draw Xs
  34. 200 for i=0 to 35
  35. 210 if a(i) then 260
  36. 220 x=(i mod 6)*20+20
  37. 230 y=i/6*20+20
  38. 240 grline x+3,y+3,x+17,y+17
  39. 250 grline x+17,y+3,x+3,y+17
  40. 260 next i
  41.  
  42. #read pen
  43. 300 t1=fn 34
  44. 310 t2=fn 34
  45. 320 if (t1=t2) then goto 310
  46. 325 sound 1000,100,2,"t"
  47. 330 x=peek(0x1c4,2)/20
  48. 340 y=peek(0x1c6,2)/20
  49. 350 j=x+6*(y-1)-1
  50.  
  51. # validate pen entry
  52. 360 if x<1 or x>6 then 800
  53. 370 if y<1 or y>6 then 800
  54.  
  55. 380 gosub 900
  56.  
  57. # did I win?
  58. 610 p=p+1
  59. 620 for i=0 to 35
  60. 630 if a(i)=0 then 100
  61. 640 next i
  62. 650 sound 1000,80,64,"tt"
  63. 660 sound 400,80,64,"tt"
  64. 670 ? "You won!  In",p,"moves."
  65. 680 input "Play Again? (y/n)",n$
  66. 690 if not n$="n" then 10
  67. 700 end
  68.  
  69. #Error
  70. 800 sound 440,18,64,"S"
  71. 810 goto 300
  72.  
  73. #Flip
  74. 900 a(j)=(a(j)-1)*(-1)
  75. 910 z=j mod 6 
  76. 920 if z=5 then 940
  77. 930  a(j+1)=(a(j+1)-1)*(-1)
  78. 940  if z=0 then 960
  79. 950 a(j-1)=(a(j-1)-1)*(-1)
  80. 960 if j>5 then a(j-6)=(a(j-6)-1)*(-1)
  81. 970 if j<30 then a(j+6)=(a(j+6)-1)*(-1)
  82. 980 return
  83.  
  84. run
  85.