Computer Science Canada Number game, made it in an hour, gimme feedback plz |
Author: | upthescale [ Tue Jan 31, 2006 11:45 pm ] |
Post subject: | Number game, made it in an hour, gimme feedback plz |
var number, guess, chancesLeft, font, x, y, button : int %%Variables font := Font.New ("chiller:60") assert font > 0 Font.Draw ("Easy", 58, 220, font, red) font := Font.New ("chiller:60") assert font > 0 Font.Draw ("Medium", 260, 220, font, red) font := Font.New ("chiller:60") assert font > 0 Font.Draw ("Hard", 540, 220, font, red) loop loop mousewhere (x, y, button) %Hard% drawfillbox (510, 200, 680, 34, 63) %Hard %Medium% drawfillbox (270, 200, 430, 34, 63) %Medium% %Easy% drawfillbox (200, 200, 34, 34, 63) %Easy% %%%%%%%Medium if x > 270 and x < 430 and y > 34 and y < 200 and button = 1 then cls chancesLeft := 4 randint (number, 1, 50) put "Pick a number between 1-50...You have 4 chances" loop get guess cls if guess > number then put "You are to high!" delay (1200) cls chancesLeft := chancesLeft - 1 put "You have ", chancesLeft, " chances left" elsif guess < number then put "You are to low!" delay (1200) cls chancesLeft := chancesLeft - 1 put "You have ", chancesLeft, " chances left" elsif guess = number then put "You are correct!" delay (1200) cls exit end if if chancesLeft = 0 then put "You have no more guesses, the number was,", number delay (4300) cls end if exit when chancesLeft = 0 end loop font := Font.New ("chiller:60") assert font > 0 Font.Draw ("Easy", 58, 220, font, red) font := Font.New ("chiller:60") assert font > 0 Font.Draw ("Medium", 260, 220, font, red) font := Font.New ("chiller:60") assert font > 0 Font.Draw ("Hard", 540, 220, font, red) %%%%%%%%Easy elsif x > 34 and x < 200 and y > 34 and y < 200 and button = 1 then cls chancesLeft := 4 randint (number, 1, 20) put "Pick a number between 1-20...You have 4 chances" loop get guess cls if guess > number then put "You are to high!" delay (1200) cls chancesLeft := chancesLeft - 1 put "You have ", chancesLeft, " chances left" elsif guess < number then put "You are to low!" delay (1200) cls chancesLeft := chancesLeft - 1 put "You have ", chancesLeft, " chances left" elsif guess = number then put "You are correct!" delay (1200) cls exit end if if chancesLeft = 0 then put "You have no more guesses, the number was, ", number delay (4300) cls end if exit when chancesLeft = 0 end loop font := Font.New ("chiller:60") assert font > 0 Font.Draw ("Easy", 58, 220, font, red) font := Font.New ("chiller:60") assert font > 0 Font.Draw ("Medium", 260, 220, font, red) font := Font.New ("chiller:60") assert font > 0 Font.Draw ("Hard", 540, 220, font, red) %%%%%%%%Hard elsif x > 510 and x < 680 and y > 34 and y < 200 and button = 1 then cls chancesLeft := 5 randint (number, 1, 100) put "Pick a number between 1-100...You have 5 chances" loop get guess cls if guess > number then put "You are to high!" delay (1200) cls chancesLeft := chancesLeft - 1 put "You have ", chancesLeft, " chances left" elsif guess < number then put "You are to low!" delay (1200) cls chancesLeft := chancesLeft - 1 put "You have ", chancesLeft, " chances left" elsif guess = number then put "You are correct!" delay (1200) cls exit end if if chancesLeft = 0 then put "You have no more guesses, the number was, ", number delay (4300) cls end if exit when chancesLeft = 0 end loop font := Font.New ("chiller:60") assert font > 0 Font.Draw ("Easy", 58, 220, font, red) font := Font.New ("chiller:60") assert font > 0 Font.Draw ("Medium", 260, 220, font, red) font := Font.New ("chiller:60") assert font > 0 Font.Draw ("Hard", 540, 220, font, red) end if end loop exit end loop %By Robbie Comeau %circa_appleyard707@hotmail.com |