Beispiel #1
0
        private Boolean setupPhases()
        {
            var conditionOrderStr = "";
            var observationCount = 0;
            Color currAColor;
            Color currBColor;
            Color currCColor;
            decimal currBDensity;
            decimal currCDensity;
            Phase currPhase = null;
            char currChar;

            try
            {
                // Initialize and set up phases
                Phases = new List<Phase>();

                conditionOrderStr = conditionOrderTB.Text;

                currAColor = backgroundA.BackColor;
                currBColor = backgroundB.BackColor;
                currCColor = backgroundC.BackColor;

                this.TrialDuration = (int)trialDurationVal.Value;
                this.TrialRestDuration = (int)trialRestDurationVal.Value;
                this.MoneyValue = startingAmountVal.Value;
                this.RewardValue = rewardVal.Value;

                observationCount = (int)mVal.Value;
                currBDensity = condBwVal.Value;
                currCDensity = condCwVal.Value;

                foreach(char c in conditionOrderStr)
                {
                    currChar = Char.ToUpper(c);

                    if (currChar == 'A')
                    {
                        currPhase = new Phase('A', currAColor, observationCount, 0, Constants.NoRank);
                    }

                    if (currChar == 'B')
                    {
                        currPhase = new Phase('B', currBColor, observationCount, currBDensity, Constants.LessThan);
                    }

                    if (currChar == 'C')
                    {
                        currPhase = new Phase('C', currCColor, observationCount, currCDensity, Constants.GreaterThan);
                    }

                    Phases.Add(currPhase);
                }

                return true;
            }
            catch (Exception e)
            {
                MessageBox.Show("Error occurred while setting up experiment: " + e.Message);
                return false;
                throw;
            }
        }
Beispiel #2
0
        public void runTrial()
        {
            try
            {
                if (PhaseQueue.Count == 0 && Phases.Count == 0)
                {
                    MessageBox.Show("Invalid phase information received. Please try again.");
                    this.Close();
                    return;
                }

                if (PhaseQueue.Count == 0)
                {
                    MessageBox.Show("Experiment completed! Thank you for participating!");
                    outputData();
                    this.Close();
                    return;
                }

                /* MODUS OPERANDI
                ------------------
                1. Dequeue our first phase
                2. Check the phase type (special shapes for baseline)
                3. Draw our board
                4. Start the timer*/

                this.CurrentPhase = PhaseQueue.Dequeue();
                this.CurrentTrial = new Trial();
                mainTimer.Interval = this.TrialDuration * 1000;
                restTimer.Interval = this.TrialRestDuration * 1000;

                //if (drawBoard()) mainTimer.Start();

                drawBoard();

            }
            catch (Exception e)
            {
                MessageBox.Show("Error occurred while running trial: " + e.Message);
                this.Close();
            }
        }