$stim = ""; $partBreak = "0"; $message = ""; $RoleSwitch = "1"; $practice = "0"; // Select random bottleneck $rStims = range(0, $numStimuli - 1); shuffle($rStims); $bottleneck_stims = array_slice($rStims, 0, $bottleneck); $header = "Round\tStimulus\tTraining\tPartBreak\tMessage\tRoleSwitch\tPractice"; $retX = $header . "\n"; foreach ($cycles as $cy) { if ($cy == "Train") { // training round $training = "1"; $trAr = repeat_array2($bottleneck_stims, $numTrainingRoundsPerCycle); shuffle($trAr); foreach ($trAr as $tr) { $stim = $tr; $thisLine = array($roundNum, $stim, $training, $partBreak, $message, $RoleSwitch, $practice); $retX = $retX . implode("\t", $thisLine); $retX = $retX . "\n"; $roundNum += 1; } } elseif ($cy == "Test") { // test round $training = "0"; //$trAr = repeat_array2($stimList,$numTestRoundsPerCycle); //shuffle($trAr); // the order of stimuli should be random, with each particpant being the speaker for each stimuli // To do this, make X lists with random order of each stimulus, then interleave them.
// training round $training = "1"; $trAr = repeat_array2($bottleneck_stims, $numTrainingRoundsPerCycle); shuffle($trAr); foreach ($trAr as $tr) { $stim = $tr; $thisLine = array($roundNum, $stim, $training, $partBreak, $message, $RoleSwitch, $practice); $retX = $retX . implode("\t", $thisLine); $retX = $retX . "\n"; $roundNum += 1; } } else { if ($cy == "Test") { // test round $training = "0"; $trAr = repeat_array2($stimList, $numTestRoundsPerCycle); shuffle($trAr); foreach ($trAr as $tr) { $stim = $tr; $thisLine = array($roundNum, $stim, $training, $partBreak, $message, $RoleSwitch, $practice); $retX = $retX . implode("\t", $thisLine); $retX = $retX . "\n"; $roundNum += 1; } } else { if ($cy == "PracticeTrain") { // add practice rounds foreach (range(-1, -4) as $pr) { $training = "1"; $stim = $pr; $thisLine = array($roundNum, $stim, $training, $partBreak, $message, $RoleSwitch, "1");