Computer Science Canada

troubleshooting help please

Author:  qwertyuiop [ Tue Dec 19, 2006 3:22 pm ]
Post subject:  troubleshooting help please

hey im so close to gettin this done.. at least i think so but i need a little help with this hangman program, the part i dont get is where all the %signs are.. heres wut i have so far
code:
%drawings
procedure Pole
    drawline (550, 175, 650, 175, black)
    drawline (600, 175, 600, 350, black)
    drawline (600, 350, 525, 350, black)
    drawline (525, 350, 525, 325, black)
end Pole

procedure Head
    drawoval (525, 309, 15, 15, black)
end Head

procedure Body
    drawline (525, 293, 525, 250, black)
end Body

procedure Leg1
    drawline (525, 250, 540, 200, black)
end Leg1

procedure Leg2
    drawline (525, 250, 515, 200, black)
end Leg2

procedure Arm1
    drawline (525, 285, 500, 250, black)
end Arm1

procedure Arm2
    drawline (525, 285, 550, 250, black)
end Arm2

%variables
var puzzle : string
var puzzle2 : string := ""
var guess : string (1)
var stream, pick : int
var count : int := 0
var data, category : string
var countr : int := 0
Pole

%getting the puzzle
open : stream, "puzzle.txt", get
loop
    exit when eof (stream)
    get : stream, data : *
    count := count + 1
end loop
close : stream
count := count div 2
open : stream, "puzzle.txt", get
randint (pick, 1, count)
for i : 1 .. pick
    get : stream, puzzle : *
    get : stream, category : *
end for

%puzzle := Str.Upper (puzzle)
for i : 1 .. length (puzzle)
    %makes the letters to _'s
    if puzzle (i) >= "a" and puzzle (i) <= "z" then
        puzzle2 := puzzle2 + "_"
    else
        %adds numbers and symbols to the string as they are
        puzzle2 := puzzle2 + puzzle (i)
    end if
end for

%puts spaces in between the underscores
locate (15, 40)
for i : 1 .. length (puzzle2)
    put puzzle2 (i), " " ..
end for
locate (16, 40)
put ""
locate (17, 40)
put category
locate (20, 15)
%displays alpabet
put "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z"
put ""
put "Enter a letter: "
loop
    %gets a guess
    getch (guess)
    %guess := Str.Upper (guess)
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %%%%%%%%%%The Part i think is wrong%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    for i : 1 .. length (puzzle)
        if guess = puzzle (i) then
            puzzle2 := puzzle2 (1 .. i - 1) + guess + puzzle2 (i + 1 .. *)

            locate (15, 40)
            put puzzle2 (i) + " "
        else
            count := count + 1
        end if
    end for
    exit when count = 6
end loop
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if count = 1 then
    Head
elsif count = 2 then
    Body
elsif count = 3 then
    Leg1
elsif count = 4 then
    Leg2
elsif count = 5 then
    Arm1
elsif count = 6 then
    Arm2
end if

Author:  BenLi [ Tue Dec 19, 2006 4:50 pm ]
Post subject: 

if you want help youy should be a bit more clear with the question you are having

does the % refer to the turing syntax or your actual game?

Author:  Bunny_Man_OC [ Tue Dec 19, 2006 5:50 pm ]
Post subject: 

BenLi wrote:
if you want help youy should be a bit more clear with the question you are having

does the % refer to the turing syntax or your actual game?


I think he's refering to the part with llines of '%' and the words "the part I think is wrong"

Author:  MyronMenezes [ Tue Jun 19, 2007 10:47 pm ]
Post subject:  Re: troubleshooting help please

tanks, the % show wrong

Author:  computerguy [ Wed Jun 20, 2007 9:07 am ]
Post subject:  RE:troubleshooting help please

MYRON MYRON MYRON


: