";
} # end pass = 5
#---------------------
# pass = 4
#---------------------
if($pass == 4){
print "";
} # end pass = 4
#------------------
# pass = 1,2,3
#------------------
if($pass >= 1 && $pass <= 3){
# $i will be used as an index value to determine which item to present
$i = $pass - 1;
print "";
} # End pass = 1,2,3
#------------------
# pass = 0
#------------------
if($pass == 0){
# Create item index
@itemIndex = &randomize(0,1,2);
# Define the conditions
$cond0= "Witches and mystics regularly use Magic 9 Balls to predict the future. Although there are skeptics about its utility, researchers have found that the Magic 9 Ball predicts future events better than chance.";
$cond1= "Witches and mystics regularly use Magic 9 Balls to predict the future. Many people are skeptical of this practice because researchers have found that the Magic 9 Ball does not predict future events better than chance.";
# randomly select a condition
$thisCondition = &randomSelect(0,1);
$color = &randomSelect('#990099','#3333CC','#009933','#CC0000','#FF9933','#660099');
print "";
} # end pass = 0
# ----------------- Subroutines -----------------------------
# for a good tutorial/overview of Perl subroutines, see
# http://www.comp.leeds.ac.uk/Perl/subroutines.html
#------------------------------------------------------------
#-----------------------
# randomSelect Subroutine
#-----------------------
sub randomSelect {
# this subroutine randomizes the elements of an array and returns the 0th value of the new array
srand;
my(@new) = ();
while (@_){
push(@new, splice(@_, rand @_,1));
}
return $new[0];
}
#-----------------------
# rondomize Subroutine
#-----------------------
sub randomize {
# this subroutine randomizes the elements of an array and returns the new array
srand;
my(@new) = ();
while (@_){
push(@new, splice(@_, rand @_,1));
}
return @new;
}
#-----------------------
# passHidden Subroutine
#-----------------------
sub passHidden {
print $query->hidden(itemIndex, @itemIndex);
print "";
print "";
print "";
print "";
print "";
print "";
print "";
print "";
print "";
}
print $query->end_html;