Home
Project Folders
Teacher Resources
Student Resources
How Do I?
Literacy
MWForum
Site Map
Search
Our Team

MWForum Message [Date Index] [Threads] [Authors] [Attachments] [Subscribe]

[Thread Prev] [Thread Next]

Subject: Quiz Project
From: mwforum@xxxxxxxxxxxxxxxxxx (Wendy Petti)
Date: Fri, 6 Jun 2003 00:29:22 -0400

I realize the question was just about keeping score, but I attach a demo
project which does several things:

1) keeps track of the number of right answers
2) keeps track of the total number of questions
3) selects random numbers for creating a math problem
4) selects a math operation at random
5) calculates the answer and compares it to the user's answer
6) announces the correct answer if the user gets it wrong
7) announces the total right out of the total questions
8) stops after 10 questions (of course this number can be adjusted... with
user input too, if you wish)

Perhaps this will give you some ideas which you can adapt for your own
purposes.  This project demonstrates how you can combine in one
announcement some fixed words and some variables, for instance.  Here is
the code.  There is a textbox named "score."

to reset
setscore 0
make "total 0
end

to start_quiz
reset
repeat 10 [
run pick [add subtract multiply divide]]
announce (se [Your score is] score [out of] :total ".)
end

to add
make "N1 random 10
make "N2 random 10
question (se :N1 "+ :N2)
ifelse answer = :N1 + :N2
  [setscore score + 1]
  [announce (se [Sorry! The answer is] :N1 + :N2 ".) ]
make "total :total + 1
end

to subtract
make "N1 10 + random 9
make "N2 random 10
question (se :N1 "- :N2)
ifelse answer = :N1 - :N2
  [setscore score + 1]
  [announce (se [Too bad! The answer is] :N1 - :N2 ".) ]
make "total :total + 1
end

to multiply
make "N1 random 10
make "N2 random 10
question (se :N1 "x :N2)
ifelse answer = :N1 * :N2
  [setscore score + 1]
  [announce (se [Oops!  The answer is] :N1 * :N2 ".) ]
make "total :total + 1
end

to divide
make "N1 random 10
make "N2 :N1 * random 10
question (se :N2 "/ :N1)
ifelse answer = :N2 / :N1
  [setscore score + 1]
  [announce (se [No, the answer is] :N2 / :n1 ".) ]
make "total :total + 1
end

* * * * *

Reminder: if you cannot access the attachments, you can retrieve them from
the attachments page at:
http://www.mathcats.com/mwforum/attachments.html

Wendy


> -----Original Message-----
> From: mwforum-admin@xxxxxxxxxxxxxxxxxx
> [mailto:mwforum-admin@xxxxxxxxxxxxxxxxxx]On Behalf Of Daniel Ajoy
> Sent: Thursday, June 05, 2003 11:14 PM
> To: mwforum@xxxxxxxxxxxxxxxxxx
> Subject: Re: [MWForum]Quiz Project
>
>
> On 5 Jun 2003 at 9:04, Donna Burns wrote:
>
> > how do I program to add points for quiz game in logos?
> > Thanks,
> > Donna
> >
>
> What about this? (project attached)
>
> to start_test
> setscore 0
>
> question [2+2]
> if answer = 4 [setscore 1 + score]
>
> question [2+1]
> if answer = 3 [setscore 1 + score]
>
> question [2+4]
> if answer = 6 [setscore 1 + score]
>
> question [1+1]
> if answer = 2 [setscore 1 + score]
> end
>
>
> Daniel
> OpenWorld Learning
>
> PS. It is Logo, not Logos.
>
>

Attachment: quiz.mw2
Description: Binary data


  • Previous by thread: Quiz Project
  • Next by thread: Trefoil knot &c.

  • To save an attachment to your computer, PC users should right-click (Mac users, click and hold the mouse button) on the link and then choose 'save target as' from the pop-up menu. A window will then pop up in which you can choose a location for the file.


    © copyright 2001 - 2008