%By: Jonathan Emes
 
%If anyone in my class used this be prepared to recieve 0                                                                                                      Jon's
 
 
proc timer
 
 
    var start, finish : int
 
 
    wallclock (start)
 
 
    loop
 
        wallclock (finish)
 
        exit when finish - start >= 5
 
        put finish - start + 1
 
        delay (1000)
 
    end loop
 
 
    drawfillbox (1, 100, 10, 200, 0)
 
 
end timer
 
 
proc popletter (var word2, word1, word3, word2_out : string)
 
 
    var letter : int
 
    var pos : array 1 .. 7 of string
 
    var guess : string
 
 
 
    for pos_set : 1 .. length (word2)
 
        pos (pos_set) := "* "
 
    end for
 
 
    for i : 1 .. length (word2)
 
 
        locatexy (40, 200)
 
        put word1 ..
 
 
        if length (word2) = 3 then
 
            put pos (1) ..
 
            put pos (2) ..
 
            put pos (3) ..
 
        elsif length (word2) = 4 then
 
            put pos (1) ..
 
            put pos (2) ..
 
            put pos (3) ..
 
            put pos (4) ..
 
        elsif length (word2) = 5 then
 
            put pos (1) ..
 
            put pos (2) ..
 
            put pos (3) ..
 
            put pos (4) ..
 
            put pos (5) ..
 
        elsif length (word2) = 6 then
 
            put pos (1) ..
 
            put pos (2) ..
 
            put pos (3) ..
 
            put pos (4) ..
 
            put pos (5) ..
 
            put pos (6) ..
 
        elsif length (word2) = 7 then
 
            put pos (1) ..
 
            put pos (2) ..
 
            put pos (3) ..
 
            put pos (4) ..
 
            put pos (5) ..
 
            put pos (6) ..
 
            put pos (7) ..
 
        end if
 
 
        put word3
 
 
        timer
 
 
        loop
 
 
            randint (letter, 1, length (word2))
 
 
            if letter = 1 and pos (letter) = "* " then
 
                pos (letter) := word2 (letter) + " "
 
                exit
 
            elsif letter = 2 and pos (letter) = "* " then
 
                pos (letter) := word2 (letter) + " "
 
                exit
 
            elsif letter = 3 and pos (letter) = "* " then
 
                pos (letter) := word2 (letter) + " "
 
                exit
 
            elsif letter = 4 and pos (letter) = "* " then
 
                pos (letter) := word2 (letter) + " "
 
                exit
 
            elsif letter = 5 and pos (letter) = "* " then
 
                pos (letter) := word2 (letter) + " "
 
                exit
 
            elsif letter = 6 and pos (letter) = "* " then
 
                pos (letter) := word2 (letter) + " "
 
                exit
 
            elsif letter = 7 and pos (letter) = "* " then
 
                pos (letter) := word2 (letter) + " "
 
                exit
 
            end if
 
 
        end loop
 
 
    end for
 
 
    locatexy (40, 200)
 
    put word1 ..
 
    put word2_out ..
 
    delay (4000)
 
 
end popletter
 
 
 
proc chain
 
 
    var word1, word2, word3, word2_out : string
 
    var rand1, rand2, rand3 : int
 
    var rand4, rand5 : int
 
 
    randint (rand1, 1, 2)
 
    randint (rand2, 3, 4)
 
    randint (rand3, 5, 6)
 
    randint (rand4, 7, 8)
 
    randint (rand5, 9, 10)
 
 
    for round_number : 1 .. 5
 
 
        if round_number = 1 then
 
            if rand1 = 1 then
 
                word1 := "park  "
 
                word2 := "bench"
 
                word2_out := "b e n c h "
 
                word3 := " mark"
 
            elsif rand1 = 2 then
 
                word1 := "haunted  "
 
                word2 := "house"
 
                word2_out := "h o u s e "
 
                word3 := " party"
 
            end if
 
        elsif round_number = 2 then
 
            if rand2 = 3 then
 
                word1 := "nose  "
 
                word2 := "job"
 
                word2_out := "j o b "
 
                word3 := " market"
 
            elsif rand2 = 4 then
 
                word1 := "car  "
 
                word2 := "lock"
 
                word2_out := "l o c k "
 
                word3 := " smith"
 
            end if
 
        elsif round_number = 3 then
 
            if rand3 = 5 then
 
                word1 := "old  "
 
                word2 := "chap"
 
                word2_out := "c h a p "
 
                word3 := " stick"
 
            elsif rand3 = 6 then
 
                word1 := "surround  "
 
                word2 := "sound"
 
                word2_out := "s o u n d "
 
                word3 := " board"
 
            end if
 
        elsif round_number = 4 then
 
            if rand4 = 7 then
 
                word1 := "chair  "
 
                word2 := "leg"
 
                word2_out := "l e g "
 
                word3 := " bone"
 
            elsif rand4 = 8 then
 
                word1 := "ice  "
 
                word2 := "cream"
 
                word2_out := "c r e a m "
 
                word3 := " of tartar"
 
            end if
 
        elsif round_number = 5 then
 
            if rand5 = 9 then
 
                word1 := "angel  "
 
                word2 := "breathe"
 
                word2_out := "b r e a t h e "
 
                word3 := " easy"
 
            elsif rand5 = 10 then
 
                word1 := "school  "
 
                word2 := "bus"
 
                word2_out := "b u s "
 
                word3 := " stop"
 
            end if
 
        end if
 
 
        %puts the letter in the word
 
        popletter (word2, word1, word3, word2_out)
 
 
    end for
 
 
end chain
 
 
chain
 
  |