Computer Science Canada

Turing Score Problem!

Author:  sp96 [ Sun Jun 19, 2011 11:18 am ]
Post subject:  Turing Score Problem!

Ok so i have to make a quiz for my programing class at school, and i made the quiz and it works but my counter for the score always shows the score as 0!





% first easy question
body win_start
cls
Pic.DrawSpecial (pic_id16, 0, 0, picCopy, picFadeIn, 500)
%question
Font.Draw ("What are the tree types of tennis court surfaces?", 200, 500, font_id, black)
%possible answers
rb1a (1) := GUI.CreateRadioButtonFull (100, 500, "Hard, Grass Clay", 0, radio_pressed, GUI.LEFT, '1')
rb1a (2) := GUI.CreateRadioButtonFull (-1, -1, "Clay, Sand, Grass", rb1a (1), radio_pressed, GUI.LEFT, '2')
rb1a (3) := GUI.CreateRadioButtonFull (-1, -1, "Gravel, Sand, Grass", rb1a (2), radio_pressed, GUI.LEFT, '3')
rb1a (4) := GUI.CreateRadioButtonFull (-1, -1, "Gravel, Sand,Clay", rb1a (3), radio_pressed, GUI.LEFT, '4')
rb1a (5) := GUI.CreateRadioButtonFull (-1, -1, "", rb1a (4), radio_pressed, GUI.LEFT, '5')
GUI.SelectRadio (rb1a (5))
GUI.Hide (rb1a (5))

%continue button
cont1a := GUI.CreateButtonFull (200, 200, 100, "Continue", cont1_esy, 0, "^C", true)
end win_start





body cont1_esy
cls

% points system that show user if answer was correct or not
if GUI.GetEventWidgetID = rb1a (1) then
counter := counter + 1
Pic.DrawSpecial (pic_id11, 200, 200, picCopy, picFadeIn, 500)
elsif GUI.GetEventWidgetID = rb1a (2) then
counter := counter + 0
Pic.DrawSpecial (pic_id12, 200, 200, picCopy, picFadeIn, 500)
elsif GUI.GetEventWidgetID = rb1a (3) then
counter := counter + 0
Pic.DrawSpecial (pic_id12, 200, 200, picCopy, picFadeIn, 500)
elsif GUI.GetEventWidgetID = rb1a (4) then
counter := counter + 0
Pic.DrawSpecial (pic_id12, 200, 200, picCopy, picFadeIn, 500)
end if

next1a := GUI.CreateButtonFull (300, 300, 100, "Next", next_easy1, 0, "^N", true)

end cont1_esy


Author:  sp96 [ Sun Jun 19, 2011 5:39 pm ]
Post subject:  RE:Turing Score Problem!

please help!

Author:  goroyoshi [ Sun Jun 19, 2011 5:42 pm ]
Post subject:  RE:Turing Score Problem!

please use syntax tags
[syntax="code here"]
put "hello world"
[/syntax]
turing should output
Turing:

put "hello world"

Author:  Tony [ Sun Jun 19, 2011 5:58 pm ]
Post subject:  RE:Turing Score Problem!

Where in that code do you draw the score to the screen?

Also, you should have answered the provided questions; namely -- what did you do to attempt to solve your problem?

Author:  sp96 [ Sun Jun 19, 2011 5:59 pm ]
Post subject:  Re: Turing Score Problem!

Thank you for letting me know

Turing:

% first easy question
body win_start
cls
Pic.DrawSpecial (pic_id16, 0, 0, picCopy, picFadeIn, 500)
%question
Font.Draw ("What are the tree types of tennis court surfaces?", 200, 500, font_id, black)
%possible answers
rb1a (1) := GUI.CreateRadioButtonFull (100, 500, "Hard, Grass Clay", 0, radio_pressed, GUI.LEFT, '1')
rb1a (2) := GUI.CreateRadioButtonFull (-1, -1, "Clay, Sand, Grass", rb1a (1), radio_pressed, GUI.LEFT, '2')
rb1a (3) := GUI.CreateRadioButtonFull (-1, -1, "Gravel, Sand, Grass", rb1a (2), radio_pressed, GUI.LEFT, '3')
rb1a (4) := GUI.CreateRadioButtonFull (-1, -1, "Gravel, Sand,Clay", rb1a (3), radio_pressed, GUI.LEFT, '4')
rb1a (5) := GUI.CreateRadioButtonFull (-1, -1, "", rb1a (4), radio_pressed, GUI.LEFT, '5')
GUI.SelectRadio (rb1a (5))
GUI.Hide (rb1a (5))

put "Score: ", counter," ."

%continue button
cont1a := GUI.CreateButtonFull (200, 200, 100, "Continue", cont1_esy, 0, "^C", true)
end win_start





body cont1_esy
cls

% points system that show user if answer was correct or not
if GUI.GetEventWidgetID = rb1a (1) then
counter := counter + 1
Pic.DrawSpecial (pic_id11, 200, 200, picCopy, picFadeIn, 500)
elsif GUI.GetEventWidgetID = rb1a (2) then
counter := counter + 0
Pic.DrawSpecial (pic_id12, 200, 200, picCopy, picFadeIn, 500)
elsif GUI.GetEventWidgetID = rb1a (3) then
counter := counter + 0
Pic.DrawSpecial (pic_id12, 200, 200, picCopy, picFadeIn, 500)
elsif GUI.GetEventWidgetID = rb1a (4) then
counter := counter + 0
Pic.DrawSpecial (pic_id12, 200, 200, picCopy, picFadeIn, 500)
end if

next1a := GUI.CreateButtonFull (300, 300, 100, "Next", next_easy1, 0, "^N", true)

end cont1_esy


So can anyone help me?

Author:  sp96 [ Sun Jun 19, 2011 6:19 pm ]
Post subject:  RE:Turing Score Problem!

Please help!

Author:  Zren [ Sun Jun 19, 2011 6:35 pm ]
Post subject:  RE:Turing Score Problem!

This line is pointless as the variable doesn't change.
counter := counter + 0

counter := counter + 1
Can also be written as:
counter += 1

That won't solve your problem though. As Tony said:
Quote:

Where in that code do you draw the score to the screen?
What did you do to attempt to solve your problem?

Author:  ProgrammingFun [ Sun Jun 19, 2011 6:36 pm ]
Post subject:  Re: RE:Turing Score Problem!

Tony @ Sun Jun 19, 2011 5:58 pm wrote:
Where in that code do you draw the score to the screen?

Also, you should have answered the provided questions; namely -- what did you do to attempt to solve your problem?

Author:  sp96 [ Sun Jun 19, 2011 6:42 pm ]
Post subject:  RE:Turing Score Problem!

I output the score ate the beginning of every question

Author:  Zren [ Sun Jun 19, 2011 6:51 pm ]
Post subject:  RE:Turing Score Problem!

It'd help if we saw maybe the next few questions, as it's obviously not the first question that's the problem...

Author:  sp96 [ Sun Jun 19, 2011 7:12 pm ]
Post subject:  Re: Turing Score Problem!

Turing:

put "hello world"
% first easy question
body win_start
cls
Pic.DrawSpecial (pic_id16, 0, 0, picCopy, picFadeIn, 500)
%question
Font.Draw ("What are the tree types of tennis court surfaces?", 200, 500, font_id, black)
%possible answers
rb1a (1) := GUI.CreateRadioButtonFull (100, 500, "Hard, Grass Clay", 0, radio_pressed, GUI.LEFT, '1')
rb1a (2) := GUI.CreateRadioButtonFull (-1, -1, "Clay, Sand, Grass", rb1a (1), radio_pressed, GUI.LEFT, '2')
rb1a (3) := GUI.CreateRadioButtonFull (-1, -1, "Gravel, Sand, Grass", rb1a (2), radio_pressed, GUI.LEFT, '3')
rb1a (4) := GUI.CreateRadioButtonFull (-1, -1, "Gravel, Sand,Clay", rb1a (3), radio_pressed, GUI.LEFT, '4')
rb1a (5) := GUI.CreateRadioButtonFull (-1, -1, "", rb1a (4), radio_pressed, GUI.LEFT, '5')

put counter

GUI.SelectRadio (rb1a (5))
GUI.Hide (rb1a (5))

%continue burron
cont1a := GUI.CreateButtonFull (200, 200, 100, "Continue", cont1_esy, 0, "^C", true)
end win_start





body cont1_esy
cls



% points system that show user if answer was correct or not
if GUI.GetEventWidgetID = rb1a (1) then
    put 11
    counter := counter + 1
    Pic.DrawSpecial (pic_id11, 200, 200, picCopy, picFadeIn, 500)
elsif GUI.GetEventWidgetID = rb1a (2) then
        put 12
counter := counter + 0
    Pic.DrawSpecial (pic_id12, 200, 200, picCopy, picFadeIn, 500)
elsif GUI.GetEventWidgetID = rb1a (3) then
    put 13
counter := counter + 0
    Pic.DrawSpecial (pic_id12, 200, 200, picCopy, picFadeIn, 500)
elsif GUI.GetEventWidgetID = rb1a (3) then
counter := counter + 0
    Pic.DrawSpecial (pic_id12, 200, 200, picCopy, picFadeIn, 500)

end if


put counter

next1a := GUI.CreateButtonFull (300, 300, 100, "Next", next_easy1, 0, "^N", true)

end cont1_esy




body next_easy1
cls
GUI.Dispose (cont1a)
GUI.Dispose (rb1a (1))
GUI.Dispose (rb1a (2))
GUI.Dispose (rb1a (3))
GUI.Dispose (rb1a (4))
GUI.Dispose (rb1a (5))
GUI.Dispose (next1a)

put counter
Pic.DrawSpecial (pic_id13, 0, 0, picCopy, picFadeIn, 500)
Font.Draw ("How many grand slams are there in a year?", 150, 500, font_id, black)
rb1b (1) := GUI.CreateRadioButtonFull (100, 500, "3", 0, radio_pressed, GUI.LEFT, '1')
rb1b (2) := GUI.CreateRadioButtonFull (-1, -1, "2", rb1b (1), radio_pressed, GUI.LEFT, '2')
rb1b (3) := GUI.CreateRadioButtonFull (-1, -1, "4", rb1b (2), radio_pressed, GUI.LEFT, '3')
rb1b (4) := GUI.CreateRadioButtonFull (-1, -1, "6", rb1b (3), radio_pressed, GUI.LEFT, '4')
rb1b (5) := GUI.CreateRadioButtonFull (-1, -1, "", rb1b (4), radio_pressed, GUI.LEFT, '5')
GUI.SelectRadio (rb1b (5))
GUI.Hide (rb1b (5))
put counter
cont1b := GUI.CreateButtonFull (200, 200, 100, "Continue", cont2_esy, 0, "^C", true)
end next_easy1



body cont2_esy
cls
if GUI.GetEventWidgetID = rb1b (1) then
    counter := counter + 0
    Pic.DrawSpecial (pic_id11, 200, 200, picCopy, picFadeIn, 500)
elsif GUI.GetEventWidgetID = rb1b (2) then
    counter := counter + 0
    Pic.DrawSpecial (pic_id12, 200, 200, picCopy, picFadeIn, 500)
elsif GUI.GetEventWidgetID = rb1b (3) then
    counter := counter + 1
    Pic.DrawSpecial (pic_id12, 200, 200, picCopy, picFadeIn, 500)
elsif GUI.GetEventWidgetID = rb1b (4) then
    counter := counter + 0
    Pic.DrawSpecial (pic_id12, 200, 200, picCopy, picFadeIn, 500)
end if

next1b := GUI.CreateButtonFull (300, 300, 100, "Next", next_easy2, 0, "^N", true)
end cont2_esy



body next_easy2
cls
GUI.Dispose (cont1b)
GUI.Dispose (rb1b (1))
GUI.Dispose (rb1b (2))
GUI.Dispose (rb1b (3))
GUI.Dispose (rb1b (4))
GUI.Dispose (rb1b (5))
GUI.Dispose (next1b)

put counter
Font.Draw ("What are the four grand slams?", 150, 500, font_id, black)
rb1c (1) := GUI.CreateRadioButtonFull (100, 500, "Australian Open, Madrid Open, Rome Open, US Open", 0, radio_pressed, GUI.LEFT, '1')
rb1c (2) := GUI.CreateRadioButtonFull (-1, -1, "Australian Open, French Open, Wimbledon, US Open", rb1c (1), radio_pressed, GUI.LEFT, '2')
rb1c (3) := GUI.CreateRadioButtonFull (-1, -1, "Australian Open, French Open, Madrid Open, Rome Open", rb1c (2), radio_pressed, GUI.LEFT, '3')
rb1c (4) := GUI.CreateRadioButtonFull (-1, -1, "Rome Open, French Open, Wimbledon, Madrid Open", rb1c (3), radio_pressed, GUI.LEFT, '4')
rb1c (5) := GUI.CreateRadioButtonFull (-1, -1, "", rb1c (4), radio_pressed, GUI.LEFT, '5')
GUI.SelectRadio (rb1c (5))
GUI.Hide (rb1c (5))

cont1c := GUI.CreateButtonFull (200, 200, 100, "Continue", cont3_esy, 0, "^C", true)
end next_easy2

Author:  sp96 [ Sun Jun 19, 2011 7:15 pm ]
Post subject:  RE:Turing Score Problem!

theres a few more questions

Author:  goroyoshi [ Sun Jun 19, 2011 8:06 pm ]
Post subject:  RE:Turing Score Problem!

then please show us the whole code for the questions

Author:  ProgrammingFun [ Sun Jun 19, 2011 8:14 pm ]
Post subject:  Re: RE:Turing Score Problem!

goroyoshi @ Sun Jun 19, 2011 8:06 pm wrote:
then please show us the whole code for the questions

...we aren't going to copy your code for anything (nor anyone else I would think). And if you want help from us, you will have to share it.

Also, you do not need to double-post...and you still aren't answering:
Tony wrote:

Where in that code do you draw the score to the screen?

Also, you should have answered the provided questions; namely -- what did you do to attempt to solve your problem?

Author:  goroyoshi [ Sun Jun 19, 2011 8:17 pm ]
Post subject:  Re: RE:Turing Score Problem!

ProgrammingFun @ Sun Jun 19, 2011 8:14 pm wrote:

Also, you do not need to double-post...

there is a handy tool on the forums called edit, you can edit your posts with it


: