| Graphs 
 
	 
	
		| Author | Message |   
		| Seguin 
 
 
 
 
 | 
			
				|  Posted: Tue May 15, 2007 7:43 am    Post subject: Graphs |  |   
				| 
 |  
				| HI, 
 I got this Provinces of Canada Quiz, you write your answers and so on. At the end you get your score in percent, now i need to create a graph that inserts the percentage results.
  I have no clue how to ge teh graph in. 
 CODE:
 
 
 	  | Turing: |  	  | 
Pic.ScreenLoad ("Map.jpg", 50, 10 , picMerge)
var  answer : string
var  s: int 
s : =0
var  font1 : int 
font1 := Font.New ("Castellar:18")
assert  font1 > 0
var  font2 : int 
font2 := Font.New ("Curlz MT:18")
assert  font2 > 0
var  font3 : int 
font3 := Font.New ("Georgia:18")
assert  font3 > 0
var  font4 : int 
font4 := Font.New ("Forte:18")
assert  font4 > 0
%%%%%%%%%%%%%%%%%%%%%
proc  bc
for  decreasing c : 2 . . 0
    % British Colombia
    Font.Draw ("What is the Capital of British Colombia?", 20 , 350 , font1, 111)
    locatexy (400 , 300)
    get  answer
    cls
    Pic.ScreenLoad ("Map.jpg", 50 , 10 , picMerge)
    Font.Draw ( answer, 50 , 150 , font3, 36)
    if  answer = "Victoria" or  answer = "victoria" then
        Font.Draw ("WOOT -happy dance-", 400 , 250 , font2, 79) 
        s :=  s+1
        delay (1000)
        exit
    else
        Font.Draw ("YOU ARE SO...NOT RIGHT!", 350 , 250 , font4, 79)
        Font.Draw ("Number of gueses left", 10 , 10 , font2, 38)
        locatexy (230 , 0)
        put  c
    end if
    if  c = 0 then
        cls
        Font.Draw ("GAME OVER!", 50 , 50 , font2, 56)
    end if
end for
cls
end  bc
%%%%%%%%%%%%
proc  ab
Pic.ScreenLoad ("Map.jpg", 50 , 10 , picMerge)
for  decreasing c : 2 . . 0
    % Alberta
    Font.Draw ("What is the Capital of Alberta?", 20 , 350 , font1, 111)
    locatexy (400 , 300)
    get  answer
    cls
    Pic.ScreenLoad ("Map.jpg", 50 , 10 , picMerge)
    Font.Draw ( answer, 100 , 120 , font3, 36)
    if  answer = "Edmonton" or  answer = "edmonton" then
        Font.Draw ("RIGHTO", 400 , 250 , font2, 79) 
         s :=  s+1
        delay (1000)
        exit
    else
        Font.Draw ("hahaha... no", 350 , 250 , font4, 79)
        Font.Draw ("Number of gueses left", 10 , 10 , font2, 38)
        locatexy (230 , 0)
        put  c
    end if
    if  c = 0 then
        cls
        Font.Draw ("GAME OVER!", 50 , 50 , font2, 56)
    end if
end for
cls
end  ab
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
proc  sas
Pic.ScreenLoad ("Map.jpg", 50 , 10 , picMerge)
for  decreasing c : 2 . . 0
    % Saskatchewan
    Font.Draw ("What is the Capital of Saskatchewan?", 20 , 350 , font1, 111)
    locatexy (400 , 300)
    get  answer
    cls
    Pic.ScreenLoad ("Map.jpg", 50 , 10 , picMerge)
    Font.Draw ( answer, 150 , 150 , font3, 36)
    if  answer = "Regina" or  answer = "regina" then
        Font.Draw ("OH YA!", 400 , 250 , font2, 79) 
         s :=  s+1
        delay (1000)
        exit
    else
        Font.Draw ("NADA", 350 , 250 , font4, 79)
        Font.Draw ("Number of gueses left", 10 , 10 , font2, 38)
        locatexy (230 , 0)
        put  c
    end if
    if  c = 0 then
        cls
        Font.Draw ("GAME OVER!", 50 , 50 , font2, 56)
    end if
end for
cls
end  sas
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
proc  man
Pic.ScreenLoad ("Map.jpg", 50 , 10 , picMerge)
for  decreasing c : 2 . . 0
    % Manitoba
    Font.Draw ("What is the Capital of Manitoba?", 20 , 350 , font1, 111)
    locatexy (400 , 300)
    get  answer
    cls
    Pic.ScreenLoad ("Map.jpg", 50 , 10 , picMerge)
    Font.Draw ( answer, 190 , 120 , font3, 36)
    if  answer = "Winnipeg" or  answer = "winnipeg" then
        Font.Draw ("YAY!", 400 , 250 , font2, 79) 
         s :=  s+1
        delay (1000)
        exit
    else
        Font.Draw ("NOPE", 350 , 250 , font4, 79)
        Font.Draw ("Number of gueses left", 10 , 10 , font2, 38)
        locatexy (230 , 0)
        put  c
    end if
    if  c = 0 then
        cls
        Font.Draw ("GAME OVER!", 50 , 50 , font2, 56)
    end if
end for
cls
end  man
%%%%%%%%%%%%%%%%%%%%%%%%%%
proc  ont
Pic.ScreenLoad ("Map.jpg", 50 , 10 , picMerge)
for  decreasing c : 2 . . 0
    % Ontario
    Font.Draw ("What is the Capital of Ontario?", 20 , 350 , font1, 111)
    locatexy (400 , 300)
    get  answer
    cls
    Pic.ScreenLoad ("Map.jpg", 50 , 10 , picMerge)
    Font.Draw ( answer, 290 , 50 , font3, 36)
    if  answer = "Toronto" or  answer = "toronto" then
        Font.Draw ("Of course you know!", 400 , 250 , font2, 79) 
         s :=  s+1
        delay (1000)
        exit
    else
        Font.Draw ("Come on!", 350 , 250 , font4, 79)
        Font.Draw ("Number of gueses left", 10 , 10 , font2, 38)
        locatexy (230 , 0)
        put  c
    end if
    if  c = 0 then
        cls
        Font.Draw ("GAME OVER!", 50 , 50 , font2, 56)
    end if
end for
cls
end  ont
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
proc  qu
Pic.ScreenLoad ("Map.jpg", 50 , 10 , picMerge)
for  decreasing c : 2 . . 0
    % Quebec
    Font.Draw ("What is the Capital of Quebec?", 20 , 350 , font1, 111)
    locatexy (400 , 300)
    get  answer
    cls
    Pic.ScreenLoad ("Map.jpg", 50 , 10 , picMerge)
    Font.Draw ( answer, 350 , 130 , font3, 36)
    if  answer = "Quebec" or  answer = "quebec" then
        Font.Draw ("BIEN OUI!!", 400 , 250 , font2, 79) 
         s :=  s+1
        delay (1000)
        exit
    else
        Font.Draw ("ALLEZ, CE N'EST PAS DIFFICILE!", 350 , 250 , font4, 79)
        Font.Draw ("Number of gueses left", 10 , 10 , font2, 38)
        locatexy (230 , 0)
        put  c
    end if
    if  c = 0 then
        cls
        Font.Draw ("GAME OVER!", 50 , 50 , font2, 56)
    end if
end for
cls
end  qu
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
proc  nb
Pic.ScreenLoad ("Map.jpg", 50 , 10 , picMerge)
for  decreasing c : 2 . . 0
    % New Brunswick
    Font.Draw ("What is the Capital of New Brunswick?", 20 , 350 , font1, 111)
    locatexy (400 , 300)
    get  answer
    cls
    Pic.ScreenLoad ("Map.jpg", 50 , 10 , picMerge)
    Font.Draw ( answer, 400 , 90 , font3, 36)
    if  answer = "Fredericton" or  answer = "fredericton" then
        Font.Draw ("SCORE!!", 400 , 250 , font2, 79) 
         s :=  s+1
        delay (1000)
        exit
    else
        Font.Draw ("MISS!", 350 , 250 , font4, 79)
        Font.Draw ("Number of gueses left", 10 , 10 , font2, 38)
        locatexy (230 , 0)
        put  c
    end if
    if  c = 0 then
        cls
        Font.Draw ("GAME OVER!", 50 , 50 , font2, 56)
    end if
end for
cls
end  nb
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
proc  ns
Pic.ScreenLoad ("Map.jpg", 50 , 10 , picMerge)
for  decreasing c : 2 . . 0
    % Quebec
    Font.Draw ("What is the Capital of Nova Scotia?", 20 , 350 , font1, 111)
    locatexy (400 , 300)
    get  answer
    cls
    Pic.ScreenLoad ("Map.jpg", 50 , 10 , picMerge)
    Font.Draw ( answer, 450 , 90 , font3, 36)
    if  answer = "Halifax" or  answer = "halifax" then
        Font.Draw ("HIT!!", 400 , 250 , font2, 79) 
         s :=  s+1
        delay (1000)
        exit
    else
        Font.Draw ("SUNK!", 350 , 250 , font4, 79)
        Font.Draw ("Number of gueses left", 10 , 10 , font2, 38)
        locatexy (230 , 0)
        put  c
    end if
    if  c = 0 then
        cls
        Font.Draw ("GAME OVER!", 50 , 50 , font2, 56)
    end if
end for
cls
end  ns
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
proc  pei
Pic.ScreenLoad ("Map.jpg", 50 , 10 , picMerge)
for  decreasing c : 2 . . 0
    % pei
    Font.Draw ("What is the Capital of PEI?", 20 , 350 , font1, 111)
    locatexy (400 , 300)
    get  answer
    cls
    Pic.ScreenLoad ("Map.jpg", 50 , 10 , picMerge)
    Font.Draw ( answer, 430 , 100 , font3, 36)
    if  answer = "Charlottetown" or  answer = "charlottetown" then
        Font.Draw ("YUPPERS!", 400 , 250 , font2, 79) 
         s :=  s+1
        delay (1000)
        exit
    else
        Font.Draw ("BLAH NO!", 350 , 250 , font4, 79)
        Font.Draw ("Number of gueses left", 10 , 10 , font2, 38)
        locatexy (230 , 0)
        put  c
    end if
    if  c = 0 then
        cls
        Font.Draw ("GAME OVER!", 50 , 50 , font2, 56)
    end if
end for
cls
end  pei
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
proc  nl
Pic.ScreenLoad ("Map.jpg", 50 , 10 , picMerge)
for  decreasing c : 2 . . 0
    % Newfoundland and Labrador
    Font.Draw ("What is the Capital of Newfoundland and Labrador?", 20 , 350 , font1, 111)
    locatexy (400 , 300)
    get  answer
    cls
    Pic.ScreenLoad ("Map.jpg", 50 , 10 , picMerge)
    Font.Draw ( answer, 450 , 150 , font3, 36)
    if  answer = "St.John's" or  answer = "st.John's" then
        Font.Draw ("Thumbs UP!!", 400 , 250 , font2, 79) 
         s :=  s+1
        delay (1000)
        exit
    else
        Font.Draw ("Thumbds Down!", 350 , 250 , font4, 79)
        Font.Draw ("Number of gueses left", 10 , 10 , font2, 38)
        locatexy (230 , 0)
        put  c
    end if
    if  c = 0 then
        cls
        Font.Draw ("GAME OVER!", 50 , 50 , font2, 56)
    end if
end for
cls
end  nl
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
proc  nt
Pic.ScreenLoad ("Map.jpg", 50 , 10 , picMerge)
for  decreasing c : 2 . . 0
    % Northwest Territories
    Font.Draw ("What is the Capital of Northwest Territories?", 20 , 350 , font1, 111)
    locatexy (400 , 300)
    get  answer
    cls
    Pic.ScreenLoad ("Map.jpg", 50 , 10 , picMerge)
    Font.Draw ( answer, 150 , 200 , font3, 36)
    if  answer = "Yellowknife" or  answer = "yellowknife" then
        Font.Draw ("GOOD!", 400 , 250 , font2, 79) 
         s :=  s+1
        delay (1000)
        exit
    else
        Font.Draw ("BAD!", 350 , 250 , font4, 79)
        Font.Draw ("Number of gueses left", 10 , 10 , font2, 38)
        locatexy (230 , 0)
        put  c
    end if
    if  c = 0 then
        cls
        Font.Draw ("GAME OVER!", 50 , 50 , font2, 56)
    end if
end for
cls
end  nt
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
proc  nu
Pic.ScreenLoad ("Map.jpg", 50 , 10 , picMerge)
for  decreasing c : 2 . . 0
    % Nunavut
    Font.Draw ("What is the Capital of Nunavut?", 20 , 350 , font1, 111)
    locatexy (400 , 300)
    get  answer
    cls
    Pic.ScreenLoad ("Map.jpg", 50 , 10 , picMerge)
    Font.Draw ( answer, 300 , 230 , font3, 36)
    if  answer = "Iqualuit" or  answer = "Iqualuit" then
        Font.Draw ("Positive!!", 400 , 250 , font2, 79) 
         s :=  s+1
        delay (1000)
        exit
    else
        Font.Draw ("Negative!", 350 , 250 , font4, 79)
        Font.Draw ("Number of gueses left", 10 , 10 , font2, 38)
        locatexy (230 , 0)
        put  c
    end if
    if  c = 0 then
        cls
        Font.Draw ("GAME OVER!", 50 , 50 , font2, 56)
    end if
end for
cls
end  nu
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
proc  yu
Pic.ScreenLoad ("Map.jpg", 50 , 10 , picMerge)
for  decreasing c : 2 . . 0
    % Yukon
    Font.Draw ("What is the Capital of Yukon?", 20 , 350 , font1, 111)
    locatexy (400 , 300)
    get  answer
    cls
    Pic.ScreenLoad ("Map.jpg", 50 , 10 , picMerge)
    Font.Draw ( answer, 70 , 230 , font3, 36)
    if  answer = "Whitehorse" or  answer = "whitehorse" then
        Font.Draw ("YES!", 400 , 250 , font2, 79) 
         s :=  s+1
        delay (1000)
        exit
    else
        Font.Draw ("NO!", 350 , 250 , font4, 79)
        Font.Draw ("Number of gueses left", 10 , 10 , font2, 38)
        locatexy (230 , 0)
        put  c
    end if
    if  c = 0 then
        cls
        Font.Draw ("GAME OVER!", 50 , 50 , font2, 56)
    end if
end for
cls
end  yu
proc  score
put "Your score is..."
put  s/13 *100
end  score
 
bc
 
ab
 
sas
 
man
 
ont
 
qu
 
nb
 
ns
 
pei
 
nl
 
nu
 
nt
 
yu
 
score
 | 
 |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| Sponsor Sponsor
 
  
   |  |   
		|  |   
		| Clayton 
 
  
 
 
 | 
			
				|  Posted: Tue May 15, 2007 8:03 am    Post subject: Re: Graphs |  |   
				| 
 |  
				| I'm not exactly sure what you want to do. Do you want to run the test multiple times and then graph the results of each test, or do you want to graph the results of each question (either 1 or 0)? A little bit better description would go a long way here. 
 
 	  | code: |  	  |  if answer = "Iqualuit" or answer = "Iqualuit" then  | 
 
 If I ever get around to spelling Iqaluit correctly, what if I forget caps lock is on and I give IQALUIT? You need to realize that there is actually
  combinations of letters for Iqaluit. Instead, you'd be better off making use of the Str.Upper() function. Take a look through your Turing help manual and check out the explanation for it. |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| rollerdude 
 
  
 
 
 | 
			
				|  Posted: Tue May 15, 2007 8:04 am    Post subject: Re: Graphs |  |   
				| 
 |  
				| just so you'll thoroughly hate us, and before clayton finds this, anyone who sees this post will first tell you to add code tags (clayton will probably correct this for you) from now on, second, for you graph 
 try something like an array that hold all your data, then, when you do your graph,use a for loop to go through the data and plot in pixels, the number of the percentage, or whatever
 |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| Tallguy 
 
  
 
 
 | 
			
				|  Posted: Thu May 17, 2007 12:14 pm    Post subject: Re: Graphs |  |   
				| 
 |  
				| its a pretty strong program, but could use more of a visual appel  |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| tenniscrazy 
 
  
 
 
 | 
			
				|  Posted: Thu May 17, 2007 7:25 pm    Post subject: RE:Graphs |  |   
				| 
 |  
				| you could draw a bar graph. 
 you would draw the outline of the grph, then put Draw.Box and create a variable for the height of each bar and change the variable depending on the percentage.
 |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| octopi 
 
  
 
 
 | 
			
				|  Posted: Thu May 17, 2007 8:15 pm    Post subject: Re: Graphs |  |   
				| 
 |  
				| I'd combine all those different proc's into one that does it all. (the only this different is the city,and province as far as I can tell, make one procedure and just pass it a variable to two)
 |  
				|  |  |   
		|  |  |  
	  
		|  |   
		|  |  
 |