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)); } }
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)); }