home *** CD-ROM | disk | FTP | other *** search
/ Explore the World of Soft…ids, Adults, Educational / RocelcoInc-ExploreTheWorldOfSoftware-KidsAdultsEducational-Vol2-Shareware.iso / educate / disk061 / truck.bas (.txt) < prev    next >
Encoding:
GW-BASIC  |  1987-05-25  |  6.4 KB  |  209 lines

  1. 10  '                            T R U C K . B A S          5/25/87 11:14 am
  2. 20  '
  3. 30  '    LOAD THE TRUCK helps with problem solving, pattern recognition,
  4. 40  '    and following orders.  Stock piles of shapes are stored on the
  5. 50  '    left side of the screen, with a loader in the middle and a
  6. 60  '    truck trailer at the bottom left.  A deisel tractor is at the
  7. 70  '    bottom right.  An order form at the top left of the screen 
  8. 80  '    indicates which shapes are needed on the trailer.  The child
  9. 90  '    must use the loader to fill the trailer with the same pattern
  10. 100  '   that is on the order form.  When the order is filled properly,
  11. 110  '   and the loader is out of the way, the tractor will back up
  12. 120  '   and haul the load away.
  13. 130  '
  14. 140  '   Converted for the IBM-PC Screen 1
  15. 150  '
  16. 160  SCREEN 1 : KEY OFF : CLS
  17. 170  COLOR 0,0 : LOCATE 25,7
  18. 180  PRINT "L O A D   T H E   T R U C K"
  19. 190  LOCATE 24,1 : PRINT "  copyright 1985, Computing Specialties";
  20. 200  '
  21. 210  '
  22. 220  '         Poke subroutine ALOAD into memory.
  23. 230  '
  24. 240  DEF SEG : ALOAD= 48000
  25. 250  FOR IB=0 TO  95 : READ BYTE : POKE ALOAD+IB,BYTE : NEXT IB
  26. 260  DATA &H55, &H8B, &HEC, &H8B, &H5E, &H0A, &H8A, &H0F, &HB5, &H00, &H8B, &H77
  27. 270  DATA &H01, &H8B, &H5E, &H08, &H8B, &H07, &H8E, &HC0, &HBF, &H00, &H00, &HA4
  28. 280  DATA &HE2, &HFD, &HB0, &H00, &HAA, &H1E, &H06, &H1F, &H07, &HB0, &H00, &HB4
  29. 290  DATA &H3D, &HBA, &H00, &H00, &HCD, &H21, &H72, &H24, &H8B, &HD8, &HB9, &H07
  30. 300  DATA &H00, &HBA, &H00, &H00, &HB4, &H3F, &HCD, &H21, &H3B, &HC1, &H74, &H05
  31. 310  DATA &HB8, &H0D, &H00, &H75, &H0F, &HBE, &H05, &H00, &H8B, &H0C, &HB4, &H3F
  32. 320  DATA &HBA, &H00, &H00, &HCD, &H21, &HB8, &H00, &H00, &H8B, &H7E, &H06, &H26
  33. 330  DATA &H89, &H05, &HB4, &H3E, &HCD, &H21, &H06, &H1F, &H5D, &HCA, &H06, &H00
  34. 340  '
  35. 350  '           Load the title picture onto the screen.
  36. 360  '
  37. 370  SEG2%=&HB800 : BERR%=0 : FILE$="TRUCK1.PIC" : CALL ALOAD(FILE$,SEG2%,BERR%)
  38. 380  '
  39. 390  '   Fill the shape tables with the figures on the screen.
  40. 400  '
  41. 410  DIM LOADER(300), TRAILER(300), TRACTOR(300), COMBO(900)
  42. 420  DIM SQUARE(100),DIAMOND(100),RECTANGLE(100),TRIANGLE(100),SIRCLE(100)
  43. 430  GET (0,7)-(15,19),SQUARE : GET (0,32)-(15,44),DIAMOND
  44. 440  GET (0,57)-(15,69),RECTANGLE : GET (0,82)-(15,94),TRIANGLE
  45. 450  GET (0,107)-(15,119),SIRCLE  : GET (144,50)-(221,76),LOADER
  46. 460  GET (11,152)-(115,168),TRAILER : GET (246,135)-(305,170),TRACTOR
  47. 470  '
  48. 480  '   Fill the order square with four random shapes.
  49. 490  '
  50. 500  LINE (223,12)-(301,30),0,BF
  51. 510  RANDOMIZE TIMER
  52. 520  FOR I=1 TO 4
  53. 530      SHAPE=INT(RND*5)+1 : XS=215+I*18 : YS=16
  54. 540      GOSUB 2020  ' PLOT SHAPE AT XS,YS
  55. 550      ORDER(I)=SHAPE
  56. 560  NEXT I
  57. 570  '
  58. 580  '   Set up the variables for moving the loader.
  59. 590  '
  60. 600  XL=145 : YL=50 : LINE (XL,YL)-(221,76),0,BF : PUT (XL,YL),LOADER,XOR
  61. 610  FOR I=1 TO 5 : NLEFT(I)=5 : NEXT I : S=1
  62. 620  YS=ORDER(S)*25-25 : NS=NLEFT(ORDER(S)) : XS=NS*15-15
  63. 630  NUL$=CHR$(0) : UP$=NUL$+CHR$(72) : DN$=NUL$+CHR$(80) : LT$=NUL$+CHR$(75)
  64. 640  RT$=NUL$+CHR$(77)
  65. 650  '
  66. 660  '   Let the buldozer move around the screen until the shape S is found.
  67. 670  '
  68. 680  C$=INKEY$
  69. 690  T=T+1 : IF T=10 THEN T=0 : SOUND 37,0.1
  70. 700  IF C$="" THEN 680
  71. 710  SOUND 37,0.1 : T=5
  72. 720  IF C$=CHR$(27) THEN RUN"MENU"
  73. 730  XO=XL : YO=YL
  74. 740  IF C$=LT$ THEN XL=XL+5*(XL>4) : GOTO 780
  75. 750  IF C$=RT$ THEN XL=XL-5*(XL<240) : GOTO 780
  76. 760  IF C$=UP$ THEN YL=YL+5*(YL>4)  : GOTO 780
  77. 770  IF C$=DN$ THEN YL=YL-5*(YL<150) : GOTO 780
  78. 780  PUT (XO,YO),LOADER,XOR
  79. 790  PUT (XL,YL),LOADER,XOR
  80. 800  WHILE INKEY$<>"" : WEND
  81. 810  IF YL<100 AND S=5 THEN GOTO 1610
  82. 820  IF XL<>XS OR YL<>YS THEN GOTO 680
  83. 830  '
  84. 840  '   The shape has been found, raise the hoist.
  85. 850  '
  86. 860  YS=YS+5 : GET (XS,YS)-(XS+17,YS+15),COMBO
  87. 870  LINE (XS,YS)-(XS+17,YS+15),0,BF : PUT (XS,YS),COMBO,XOR
  88. 880  FOR I=1 TO 5
  89. 890    PUT (XS,YS),COMBO,XOR
  90. 900    YS=YS-1
  91. 910    PUT (XS,YS),COMBO,XOR
  92. 920    SOUND 100+I*5,1
  93. 930  NEXT I
  94. 940  GOSUB 2080
  95. 950  '
  96. 960  '   Get the loader and shape as one figure.
  97. 970  '
  98. 980  GET (XL+2,YL)-(XL+77,YL+25),COMBO : LINE (XL+2,YL)-(XL+77,YL+25),0,BF
  99. 990  PUT (XL,YL),COMBO,XOR : XS=110 : YS=140
  100. 1000  '
  101. 1010  '   Let the buldozer move around the screen until it gets to the
  102. 1020  '   back of the trailer.
  103. 1030  '
  104. 1040  C$=INKEY$
  105. 1050  T=T+1 : IF T=10 THEN T=0 : SOUND 57,0.1
  106. 1060  IF C$="" THEN 1040
  107. 1070  SOUND 57,0.1 : T=5
  108. 1080  IF C$=CHR$(27) THEN RUN"MENU
  109. 1090  XO=XL : YO=YL
  110. 1100  IF C$=LT$ THEN XL=XL+5*(XL>4) : GOTO 1140
  111. 1110  IF C$=RT$ THEN XL=XL-5*(XL<240) : GOTO 1140
  112. 1120  IF C$=UP$ THEN YL=YL+5*(YL>4)  : GOTO 1140
  113. 1130  IF C$=DN$ THEN YL=YL-5*(YL<150) : GOTO 1140
  114. 1140  PUT (XO,YO),COMBO,XOR
  115. 1150  PUT (XL,YL),COMBO,XOR
  116. 1160  WHILE INKEY$<>"" : WEND
  117. 1170  IF XL<>XS OR YL<>YS THEN GOTO 1040
  118. 1180  '
  119. 1190  '   The trailer has been found, slide the shape back onto the truck
  120. 1200  '
  121. 1210  GET (XS-50,YS)-(XS+15,YS+13),COMBO
  122. 1220  LINE (XS-50,YS)-(XS+15,YS+13),0,BF : PUT (XS-50,YS),COMBO,XOR
  123. 1230  FOR I=1 TO 15
  124. 1240    PUT (XS-50,YS),COMBO,XOR
  125. 1250    XS=XS-1
  126. 1260    PUT (XS-50,YS),COMBO,XOR
  127. 1270  SOUND 150+I*10,1
  128. 1280  NEXT I
  129. 1290  GOSUB 2080
  130. 1300  GET (XS+14,YS)-(XS+15,YS+13),COMBO : LINE (XS+14,YS)-(XS+15,YS+13),0,BF
  131. 1310  XS=XS+14 : PUT (XS,YS),COMBO,XOR
  132. 1320  FOR I=1 TO 15
  133. 1330    PUT (XS,YS),COMBO,XOR
  134. 1340    XS=XS+1
  135. 1350    PUT (XS,YS),COMBO,XOR
  136. 1360  SOUND 300-I*10,1
  137. 1370  NEXT I
  138. 1380  GOSUB 2080
  139. 1390  '
  140. 1400  '   The shape has been loaded, lower the hoist.
  141. 1410  '
  142. 1420  YS=YL : XS=XL : GET (XS,YS)-(XS+15,YS+15),COMBO
  143. 1430  LINE (XS,YS)-(XS+15,YS+15),0,BF : PUT (XS,YS),COMBO,XOR
  144. 1440  FOR I=1 TO 5
  145. 1450    PUT (XS,YS),COMBO,XOR
  146. 1460    YS=YS+1
  147. 1470    PUT (XS,YS),COMBO,XOR
  148. 1480  SOUND 125-I*5,1
  149. 1490  NEXT I
  150. 1500  GOSUB 2080
  151. 1510  '
  152. 1520  '   Switch to the regular loader again and go back for another shape.
  153. 1530  '
  154. 1540  LINE (XL,YL)-(XL+76,YL+26),0,BF
  155. 1550  PUT (XL,YL),LOADER,XOR
  156. 1560  NLEFT(ORDER(S))=NLEFT(ORDER(S))-1
  157. 1570  S=S+1
  158. 1580  GOTO 620
  159. 1590  '
  160. 1600  '   The truck is loaded and the loader is out of the way,
  161. 1610  '  Back the truck up.
  162. 1620  '
  163. 1630  XT=246 : YT=133 : LINE (246,135)-(305,170),0,BF : PUT (XT,YT),TRACTOR,XOR
  164. 1640  PLAY "O1C2P4C2"
  165. 1650  WHILE XT>100
  166. 1660    PUT (XT,YT),TRACTOR,XOR
  167. 1670    XT=XT-5
  168. 1680    PUT (XT,YT),TRACTOR,XOR
  169. 1690    SOUND 300,0.1
  170. 1700  WEND
  171. 1710  '
  172. 1720  '  Haul the load off
  173. 1730  '
  174. 1740  PLAY "O1C2P4C2P4CDEF8P8CDEF8P8"
  175. 1750  GET (5,134)-(175,170),COMBO : XT=5 : YT=134
  176. 1760  WHILE XT<145
  177. 1770    XT=XT+5 : PUT (XT,YT),COMBO,PSET
  178. 1780    SOUND 300,0.1
  179. 1790  WEND
  180. 1800  WHILE XT<314
  181. 1810    GET (XT,YT)-(314,170),COMBO
  182. 1820    XT=XT+5 : PUT (XT,YT),COMBO,PSET
  183. 1830  SOUND 300,0.1
  184. 1840  WEND
  185. 1850  FOR I=1 TO 2000 : NEXT I
  186. 1860  '
  187. 1870  '  Set up the screen for a new game.
  188. 1880  '
  189. 1890  CLS : LOCATE 25,7
  190. 1900  PRINT "L O A D   T H E   T R U C K";
  191. 1910  PUT (144,50),LOADER,PSET
  192. 1920  PUT (11,152),TRAILER,PSET : PUT (246,135),TRACTOR,PSET
  193. 1930  FOR I=0 TO 4
  194. 1940     PUT (I*16,7),SQUARE,PSET
  195. 1950     PUT (I*16,32),DIAMOND,PSET
  196. 1960     PUT (I*16,57),RECTANGLE,PSET
  197. 1970     PUT (I*16,82),TRIANGLE,PSET
  198. 1980     PUT (I*16,107),SIRCLE,PSET
  199. 1990  NEXT I
  200. 2000  LINE(222,11)-(302,31),3,B
  201. 2010  GOTO 520
  202. 2020  ON SHAPE GOTO 2030,2040,2050,2060,2070
  203. 2030  PUT (XS,YS),SQUARE : RETURN
  204. 2040  PUT (XS,YS),DIAMOND : RETURN
  205. 2050  PUT (XS,YS),RECTANGLE : RETURN
  206. 2060  PUT (XS,YS),TRIANGLE : RETURN
  207. 2070  PUT (XS,YS),SIRCLE : RETURN
  208. 2080  FOR I=1 TO 300 : NEXT I : RETURN
  209.