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

  1. # SIMON V1.0
  2. # Freeware
  3. # By Alex Garza (02/13/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. 10 dim a(50)
  15. 20 gosub 400
  16. 30 s=30
  17. 40 ? "SIMON SAYS: Press OK to start."
  18.  
  19. # main loop
  20. 50 for c=1 to 50
  21. 60 a(c)=rnd(9)
  22. 70 if c>4 then s=45
  23. 80 if c>9 then s=100
  24.  
  25. # pilot's turn
  26. 90 for b=1 to c
  27. 100 j=a(b)
  28. 110 gosub 500
  29. 120 gosub 400
  30. 130 next b
  31.  
  32. # human's turn
  33. 140 for b=1 to c
  34. 150 gosub 700
  35. 160 gosub 500
  36. 170 gosub 400
  37. 180 if a(b) <> j then 900
  38. 190  next b
  39. 200 o=fn 22
  40. 210 next c
  41. 220 ? "Congratulations! You won."
  42. 230 goto 910
  43.  
  44. # clear screen
  45. 400 o=fn(42)
  46.  
  47. # draw grid
  48. 410 for i=20 to 140 step 40
  49. 420 grline i,20,i,140
  50. 430 grline 20,i,140,i
  51. 440 next i
  52. 450 return
  53.  
  54. # draw square
  55. 500 x=(j mod 3)*40+20
  56. 510 y=j/3*40+20
  57. 520 f=400*(1.05946^j)
  58. 530for i=2 to 38 step 4
  59. 540 grline  x+i,y+40-i,x+i,y+i
  60. 550 grline x+40-i,y+i,x+i,y+i
  61. 560 next i
  62. 570 sound f,s,32,"t"
  63. 580 return
  64.  
  65. #read pen
  66. 700 t1=fn 34
  67. 710 t2=fn 34 
  68. 720 if (t1=t2) then goto 710
  69. 730 x=(peek(0x1c4,2)+20)/40
  70. 740 y=(peek(0x1c6,2)+20)/40
  71. 750 j=x+3*(y-1)-1
  72.  
  73. # validate pen entry
  74. 760 if x<1 or x>3 then 790
  75. 770 if y<1 or y>3 then 790
  76. 780 return
  77. 790 sound 440,18,64,"S"
  78. 800 goto 700
  79.  
  80. # end
  81. 900 ? "Sorry, Wrong move! Correct:",c-1
  82. 910 input "Play Again? (y/n)",n$
  83. 920 if not n$="n" then 20
  84. 930 end
  85.  
  86. run
  87.