Beispiel #1
0
        protected List <IRoundItem> GetFirstSteps()
        {
            MemoflowConfiguration memoflowConfig = (MemoflowConfiguration)ExerciseConfiguration;
            //init initial Field
            int numFirststeps            = memoflowConfig.Levels[CurrentDifficulty].NumCards;
            List <IRoundItem> firstSteps = new List <IRoundItem>();

            for (int i = 0; i < numFirststeps; i++)
            {
                if (i == 0)
                {
                    firstSteps.Add(new MemoflowStepVO(_availableSymbols[_random.Next(0, _availableSymbols.Length)],
                                                      _availableColors[_colorIndex],
                                                      _availableColors[_random.Next(0, _availableColors.Length)], _availableRotations[_random.Next(0, _availableRotations.Length)]));
                }
                else
                {
                    double rnd = _random.NextDouble();
                    if (rnd < memoflowConfig.MatchProbability)
                    {
                        var validMatches           = GetValidMatches();
                        MemoflowMatchType newMatch = validMatches[_random.Next(0, validMatches.Length)];
                        firstSteps.Add(CreateStepWithMatch(firstSteps[firstSteps.Count - 1] as MemoflowStepVO, newMatch));
                    }
                    else
                    {
                        firstSteps.Add(CreateStepWithMatch(firstSteps[firstSteps.Count - 1] as MemoflowStepVO, MemoflowMatchType.NO));
                    }
                }
            }
            return(firstSteps);
        }
Beispiel #2
0
        protected IRoundItem CreateStep()
        {
            MemoflowConfiguration nBackConfig = (MemoflowConfiguration)ExerciseConfiguration;
            int            numCards           = nBackConfig.Levels[CurrentDifficulty].NumCards;
            double         rnd  = _random.NextDouble();
            MemoflowStepVO step = _questQueue[_questQueue.Count - numCards + 1] as MemoflowStepVO;

            if (rnd < nBackConfig.MatchProbability)
            {
                var validMatches           = GetValidMatches();
                MemoflowMatchType newMatch = validMatches[_random.Next(0, validMatches.Length)];
                return(CreateStepWithMatch(step as MemoflowStepVO, newMatch));
            }
            else
            {
                return(CreateStepWithMatch(step as MemoflowStepVO, MemoflowMatchType.NO));
            }
        }
Beispiel #3
0
        protected virtual MemoflowStepVO CreateStepWithMatch(MemoflowStepVO nbs, MemoflowMatchType matchType)
        {
            MemoflowConfiguration memoflowConfig = (MemoflowConfiguration)ExerciseConfiguration;

            //create completely different step...
            int             symbol      = GetUniqueElement(_availableSymbols, nbs.SymbolId);
            AvailableColors borderColor = GetUniqueElement(_availableColors, nbs.BorderColor);
            float           rotation    = GetUniqueElement(_availableRotations, nbs.Rot);

            //...add a match if necessary
            if (matchType == MemoflowMatchType.COLOR)
            {
                borderColor = nbs.BorderColor;
            }
            if (matchType == MemoflowMatchType.SYMBOL)
            {
                symbol = nbs.SymbolId;
            }
            //if( matchType == MATCH_TYPE.ROTATION) rotation = nbs.rotation;

            //otherwise NO_MATCH was the case.
            return(new MemoflowStepVO(symbol, _availableColors[_colorIndex], borderColor, rotation));
        }
 public MemoflowSolution(MemoflowMatchType matchType)
 {
     MatchTypes = new MemoflowMatchType[] { matchType };
 }