Computer Science Canada TURING BASEBALL PROGRAM HELP |
Author: | Super [ Sat Jan 17, 2004 11:26 pm ] |
Post subject: | TURING BASEBALL PROGRAM HELP |
I have made a baseball game where the user can choose to play again or exit after playing one game. But if they choose to play again, it goes to the outcome of their last game. HELP PLEASE! %Results of Game procedure strikeoutresult title color (12) put "NADIM STRUCK HIM OUT!" GUI.Show (draw9) GUI.Enable (draw9) end strikeoutresult procedure walkresult title put "BOO" color (12) GUI.Show (draw9) GUI.Enable (draw9) end walkresult procedure hitBatter title color (12) put "hit batter" GUI.Show (draw9) GUI.Enable (draw9) end hitBatter %Game using fastball procedure fastballScreen title picture13 x11 := 300 x21 := 392 y11 := 200 y21 := 275 % drawbox (x11, y11, x21, y21, 12) % drawbox (330, 230, 350, 255, 14) % drawbox (300, 255, 365, 275, 12) % drawbox (300, 230, 330, 255, 9) % drawbox (300, 200, 375, 230, 12) % drawbox (350, 230, 370, 255, 14) % drawbox (365, 255, 375, 268, 9) % drawbox (375, 200, 392, 213, 12) % %---- % drawbox (375, 213, 392, 275, 12) % drawbox (365, 268, 375, 275, 9) % drawbox (370, 230, 375, 255, 100) %----- color (12) colorback (7) locate (4, 67) put "Strikes" locate (7, 68) put "Balls" locate (10, 66) put "Pitch Speed" loop setscreen("offscreenonly") var strikes : int := 0 var balls : int := 0 var randomspeed : int var draw9 : int := 0 loop mousewhere (xmouse1, ymouse1, button1) if (xmouse1 >= 330 and xmouse1 <= 350) and (ymouse1 >= 230 and ymouse1 <= 255) and button1 = 1 then strikes := strikes + 1 for x : 1 .. 10 picture13 drawfilloval (310 + x * 3, 250 - x, 3, 3, 31) delay (10) drawfilloval (310 + x * 3, 250 - x, 2, 2, 42) color (12) colorback (7) locate (5, 70) put strikes end for randomize randint (randomspeed, 75, 100) locate (11, 70) put randomspeed delay (1500) color (7) locate (11, 70) put randomspeed color (12) locate (20, 20) put "NICE PITCH!" delay (2000) color (7) locate (20, 20) put "NICE PITCH!" if randomspeed > 94 then locate (20, 20) color (12) put "You're really bringing the heat tonight!" delay (1500) color (7) locate (20, 20) put "You're really bringing the heat tonight!" elsif randomspeed < 80 then locate (20, 20) color (12) put "COME ON! YOU CALL THAT A FAST BALL? THROW HARDER!" delay (1500) locate (20, 20) color (7) put "COME ON! YOU CALL THAT A FAST BALL? THROW HARDER!" end if picture14 delay (1000) picture13 elsif xmouse1 >= 300 and xmouse1 <= 365 and ymouse1 >= 255 and ymouse1 <= 275 and button1 = 1 then balls := balls + 1 for x : 1 .. 35 picture13 drawfilloval (310 + x, 260, 3, 3, 31) delay (3) drawfilloval (310 + x, 260, 2, 2, 42) color (12) colorback (7) locate (8, 70) put balls end for randomize randint (randomspeed, 75, 85) locate (11, 70) color (12) put randomspeed delay (1500) color (7) locate (11, 70) put randomspeed locate (20, 20) color (12) put "TOO HIGH!" delay (2000) color (7) locate (20, 20) put "TOO HIGH!" if randomspeed < 80 then locate (20, 20) color (12) put "COME ON! YOU CALL THAT A FAST BALL? THROW HARDER!" delay (1500) locate (20, 20) color (7) put "COME ON! YOU CALL THAT A FAST BALL? THROW HARDER!" end if picture16 delay (1000) picture13 elsif xmouse1 >= 300 and xmouse1 <= 330 and ymouse1 >= 230 and ymouse1 <= 255 and button1 = 1 then balls := balls + 1 for x : 1 .. 5 picture13 drawfilloval (310 + x * 3, 245, 3, 3, 31) delay (40) drawfilloval (310 + x * 3, 245, 2, 2, 42) color (12) colorback (7) locate (8, 70) put balls end for randomize randint (randomspeed, 75, 90) locate (11, 70) color (12) put randomspeed delay (1500) color (7) locate (11, 70) put randomspeed locate (20, 20) color (12) put "TOO FAR OUTSIDE!" delay (2000) color (7) locate (20, 20) put "TOO FAR OUTSIDE!" if randomspeed < 80 then locate (20, 20) color (12) put "COME ON! YOU CALL THAT A FAST BALL? THROW HARDER!" delay (1500) locate (20, 20) color (7) put "COME ON! YOU CALL THAT A FAST BALL? THROW HARDER!" end if picture15 delay (1000) picture13 elsif xmouse1 >= 300 and xmouse1 <= 375 and ymouse1 >= 200 and ymouse1 <= 230 and button1 = 1 then balls := balls + 1 for x : 1 .. 30 picture13 drawfilloval (310 + x, 245 - x, 3, 3, 31) delay (6) drawfilloval (310 + x, 245 - x, 2, 2, 42) color (12) colorback (7) locate (8, 70) put balls end for randomize randint (randomspeed, 75, 90) locate (11, 70) color (12) put randomspeed delay (1500) color (7) locate (11, 70) put randomspeed locate (20, 20) color (12) put "TOO LOW!" delay (2000) color (7) locate (20, 20) put "TOO LOW!" if randomspeed < 80 then locate (20, 20) color (12) put "COME ON! YOU CALL THAT A FAST BALL? THROW HARDER!" delay (1500) locate (20, 20) color (7) put "COME ON! YOU CALL THAT A FAST BALL? THROW HARDER!" end if picture17 delay (1000) picture13 elsif xmouse1 >= 350 and xmouse1 <= 370 and ymouse1 >= 230 and ymouse1 <= 255 and button1 = 1 then balls := balls + 1 for x : 1 .. 55 picture13 drawfilloval (310 + x, 245, 3, 3, 31) delay (1) drawfilloval (310 + x, 245, 2, 2, 42) color (12) colorback (7) locate (8, 70) put balls end for randomize randint (randomspeed, 75, 95) locate (11, 70) color (12) put randomspeed delay (1500) color (7) locate (11, 70) put randomspeed locate (20, 20) color (12) put "TOO FAR INSIDE!" delay (2000) color (7) locate (20, 20) put "TOO FAR INSIDE!" if randomspeed > 94 then locate (20, 20) color (12) put "You're throwing some fireballs tonight!" delay (1500) color (7) locate (20, 20) put "You're throwing some fireballs tonight!" elsif randomspeed < 80 then locate (20, 20) color (12) put "COME ON! YOU CALL THAT A FAST BALL? THROW HARDER!" delay (1500) locate (20, 20) color (7) put "COME ON! YOU CALL THAT A FAST BALL? THROW HARDER!" end if picture18 delay (1000) picture13 elsif xmouse1 >= 365 and xmouse1 <= 375 and ymouse1 >= 255 and ymouse1 <= 268 and button1 = 1 then balls := balls + 1 for x : 1 .. 62 picture13 drawfilloval (310 + x, 260, 3, 3, 31) delay (4) drawfilloval (310 + x, 260, 2, 2, 42) color (12) colorback (7) locate (8, 70) put balls end for randomize randint (randomspeed, 75, 90) locate (11, 70) color (12) put randomspeed delay (1500) color (7) locate (11, 70) put randomspeed locate (20, 20) color (12) put "WAY TOO FAR INSIDE! CAREFUL, YOU ALMOST HIT THE BATTER!" delay (2000) color (7) locate (20, 20) put "WAY TOO FAR INSIDE! CAREFUL, YOU ALMOST HIT THE BATTER!" if randomspeed < 80 then locate (20, 20) color (12) put "COME ON! YOU CALL THAT A FAST BALL? THROW HARDER!" delay (1500) locate (20, 20) color (7) put "COME ON! YOU CALL THAT A FAST BALL? THROW HARDER!" end if picture18 delay (1000) picture13 elsif xmouse1 >= 375 and xmouse1 <= 392 and ymouse1 >= 200 and ymouse1 <= 213 and button1 = 1 then balls := balls + 1 for x : 1 .. 62 picture13 drawfilloval (310 + x, 260 - x div 1.5, 3, 3, 31) delay (1) drawfilloval (310 + x, 260 - x div 1.5, 2, 2, 42) color (12) colorback (7) locate (8, 70) put balls end for randomize randint (randomspeed, 75, 100) locate (11, 70) color (12) put randomspeed delay (1500) color (7) locate (11, 70) put randomspeed locate (20, 20) color (12) put "TOO LOW AND INSIDE! CAREFUL, YOU ALMOST HIT THE BATTER!" delay (2000) color (7) locate (20, 20) put "TOO LOW AND INSIDE! CAREFUL, YOU ALMOST HIT THE BATTER!" if randomspeed > 94 then locate (20, 20) color (12) put "That 2-seamer was blazing!" delay (1500) color (7) locate (20, 20) put "That 2-seamer was blazing!" elsif randomspeed < 80 then locate (20, 20) color (12) put "COME ON! YOU CALL THAT A FAST BALL? THROW HARDER!" delay (1500) locate (20, 20) color (7) put "COME ON! YOU CALL THAT A FAST BALL? THROW HARDER!" end if picture18 delay (1000) picture13 else if xmouse1 >= 375 and xmouse1 <= 392 and ymouse1 >= 213 and ymouse1 <= 275 and button1 = 1 or xmouse1 >= 365 and xmouse1 <= 375 and ymouse1 >= 230 and ymouse1 <= 255 and button1 = 1 or xmouse1 >= 370 and xmouse1 <= 375 and ymouse1 >= 230 and ymouse1 >= 255 and button1 = 1 then for x : 1 .. 70 picture13 drawfilloval (310 + x, 260, 3, 3, 31) delay (1) drawfilloval (310 + x, 260, 2, 2, 42) color (12) colorback (7) end for randomize randint (randomspeed, 75, 100) locate (11, 70) color (12) put randomspeed delay (1500) color (7) locate (11, 70) put randomspeed locate (20, 20) color (12) put "YOU HIT THE BATTER! GAME OVER!" delay (2000) color (7) locate (20, 20) put "YOU HIT THE BATTER! GAME OVER!" picture19 delay (1000) picture13 exit end if end if exit when strikes =3 or balls=4 end loop ![]() strikeoutresult end if if balls = 4 then walkresult end if if xmouse1 >= 375 and xmouse1 <= 392 and ymouse1 >= 213 and ymouse1 <= 275 and button1 = 1 or xmouse1 >= 365 and xmouse1 <= 375 and ymouse1 >= 230 and ymouse1 <= 255 and button1 = 1 or xmouse1 >= 370 and xmouse1 <= 375 and ymouse1 >= 230 and ymouse1 >= 255 and button1 = 1 then hitBatter end if end loop end fastballScreen |