This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-03-04 19:40:28

sprites4u
New Scratcher
Registered: 2012-03-04
Posts: 1

Random generation of questions but no repeats? PLEASE HELP!!!

I need to make a 10 question quiz game. I am using two imported lists, one is questions and the other is answers.

I need to know how to generate the questions randomly and if the player answers correctly, then they don't get asked that same question again.

If they get it incorrect, it will not be deleted and will be asked again randomly later.

Does anyone know how to do this?

THANK YOU SO MUCH!

Offline

 

#2 2012-03-05 00:18:25

trinary
Scratcher
Registered: 2012-01-29
Posts: 1000+

Re: Random generation of questions but no repeats? PLEASE HELP!!!

Use:

when clicked
delete
all
of
done
set
score
to
0
set
question#
to
1
repeat
length of
questions
repeat until
not
done
contains
question#
set
question#
to
pick random
1
to
length of
questions
ask
item
question#
of
questions
and wait
if
answer
=
item
question#
of
questions
change
score
by
1
add
question#
to
done
say
Correct.
for
2
secs
else
say
Wrong.
for
2
secs

Last edited by trinary (2012-03-05 00:18:47)


http://trinary.tk/images/signature_.php

Offline

 

#3 2012-03-05 09:01:17

sarahmi
New Scratcher
Registered: 2012-03-04
Posts: 1

Re: Random generation of questions but no repeats? PLEASE HELP!!!

Trinary,

I have the exact same need but your answer is too advanced for me just now.

I want to do a quiz which isn't over until all questions have been answered
correctly.

If a student gets one wrong, it goes back into the pile and re-emerges at random
later on. If a student gets one right, that question is eliminated and will not be re-asked.

Could you give a pseudo code description of how that should be tackled?

Offline

 

#4 2012-03-05 12:08:45

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Random generation of questions but no repeats? PLEASE HELP!!!

sarahmi wrote:

Trinary,

I have the exact same need but your answer is too advanced for me just now.

I want to do a quiz which isn't over until all questions have been answered
correctly.

If a student gets one wrong, it goes back into the pile and re-emerges at random
later on. If a student gets one right, that question is eliminated and will not be re-asked.

Could you give a pseudo code description of how that should be tackled?

Well, you'd first want to check if the answer was right.  tongue
Then, if it was, you delete it from a list of questions. Otherwise, save it in a variable, delete it from the list, then

insert
old question
at
any
of
questions

smile

Offline

 

Board footer