Computer Science Canada hangman game turing |
Author: | Skxox [ Thu Dec 18, 2014 1:09 pm ] |
Post subject: | hangman game turing |
var pig : string var cow : string var rooster : string var chicken : string var hen : string var horse : string var donkey : string var dog : string var cat : string var piglette : string var wordpicker : int var bodyparts : int := 0 const VOWELS : string := "AEIOUaeiou" const CONSONANTS : string := "BCDFGHJKLMNPQRSTVWXYZbcdfghjklmnpqrstvwxyz" var Correctword : string := "" var word : string := "" var letter : string := "" randint (wordpicker, 1, 10) if wordpicker = 1 then Correctword = "pig" elsif wordpicker = 2 then Correctword = "cow" elsif wordpicker = 3 then Correctword = "rooster" elsif wordpicker = 4 then Correctword = "chicken" elsif wordpicker = 5 then Correctword = "hen" elsif wordpicker = 6 then Correctword = "horse" elsif wordpicker = 7 then Correctword = "donkey" elsif wordpicker = 8 then Correctword = "dog" elsif wordpicker = 9 then Correctword = "cat" else Correctword = "piglette" end if put " _ stands for a consonant" put " * stands for a vowel " put skip loop for i : 1 .. length (Correctword) if index (letter, Correctword (i)) not= 0 then word := word + Correctword (i) cls put skip elsif index (CONSONANTS, Correctword (i)) not= 0 then word := word + "-" elsif index (VOWELS, Correctword (i)) not= 0 then word := word + "*" else word := word + Correctword (i) end if end for put " the word to guess is ", word if word = Correctword then exit if bodyparts = 1 then %Draws the head Draw.Oval (125, 215, 25, 25, 255) elsif bodyparts = 2 then %draws body drawline (125, 190, 125, 110, 255) elsif bodyparts = 3 then %draws arms drawline (125, 185, 100, 120, 255) %left arm elsif bodyparts = 4 then drawline (125, 185, 150, 120, 255) %right arm elsif bodyparts = 5 then %draws legs drawline (125, 110, 100, 60, 255) %left leg elsif bodyparts = 6 then drawline (125, 110, 150, 60, 255) %right leg end if end if var guess : string put "please enter your guess " .. get guess letter := letter + guess word := " " end loop put "CONGRATS! you guessed it" put skip, "thanks for playing" can someone help me finish this please |