bool CheckLineToPrint(SlotLine lineId, GenSymbolId symbolId, SymbolCombination symbolCombination, MatrixInWork matrix) { int maxMajorSymbols = symbolCombination.count; for (int i = 0; i < lineId.indexOnDrum.Length; i++) { int indexInDrum = lineId.indexOnDrum[i]; SymbolInWork matrixSymbol = matrix.symbols[i][indexInDrum]; if (i < maxMajorSymbols) { if ((matrixSymbol.symbolMask & symbolId.symbolId) == 0) { return(false); } } else { if ((matrixSymbol.symbolMask & symbolId.symbolId) != 0 && matrixSymbol.fixedSymbol) { return(false); } } } return(true); }
bool RemoveLine(SlotLine lineId, GenSymbolId symbolId, MatrixInWork matrix) { int maxMajorDrums = symbolId.symbolConfig.combinations[0].count; for (int i = 1; i < maxMajorDrums; i++) { SymbolInWork workSymbol = matrix.symbols[i][lineId.indexOnDrum[i]]; uint symbolMask = workSymbol.symbolMask; if ((symbolMask & symbolId.symbolId) == 0) { return(true); } else if (!workSymbol.fixedSymbol) { workSymbol.symbolMask = workSymbol.symbolMask - symbolId.symbolId; return(true); } } for (int i = maxMajorDrums; i < lineId.indexOnDrum.Length; i++) { SymbolInWork workSymbol = matrix.symbols[i][lineId.indexOnDrum[i]]; if (!workSymbol.fixedSymbol) { workSymbol.symbolMask = workSymbol.symbolMask - symbolId.symbolId; } } return(false); }
void CopyLinesFrom5X() { lines = new SlotLine[lines5x.Length]; for (int i = 0; i < lines5x.Length; i++) { lines[i] = new SlotLine(); lines[i].indexOnDrum = lines5x[i].indexOnDrum; lines[i].tag = lines5x[i].tag; } }
SymbolStepResultType FindMatrixForSymbol(int posOnFirstDrum, GenSymbolId symbolId, MatrixInWork startMatrix, float maxEstimateReward, float chanceModificator, List <string> usedLines, out MatrixStepBySymbol result) { result = new MatrixStepBySymbol(); List <GenLineId> linesForIndex = new List <GenLineId>(); foreach (var curLine in lineIdToGenLine.Values) { if (curLine.lineConfig.indexOnDrum[0] == posOnFirstDrum && !usedLines.Contains(curLine.lineConfig.tag) && CheckForAvaliableLine(symbolId, curLine, startMatrix)) { linesForIndex.Add(curLine); } } if (linesForIndex.Count == 0) { return(SymbolStepResultType.NoAvaliableLines); } float maxThreshold = symbolId.symbolConfig.GetMinimumReward() / 2.0f; var chances = CalculateFactorChances(symbolId.symbolConfig.combinations, chanceModificator); SymbolCombination selectedCombination = null; if (symbolId.symbolConfig.combinations[0].reward > (maxEstimateReward + maxThreshold)) { return(SymbolStepResultType.EstimateRewardIsSmall); } else if (Mathf.Abs(symbolId.symbolConfig.combinations[0].reward - maxEstimateReward) < maxThreshold) { selectedCombination = symbolId.symbolConfig.combinations[0]; } while (selectedCombination == null) { SymbolCombination randomCombination = GetRandomCombination(chances); if (randomCombination.reward > (maxEstimateReward + maxThreshold) && chances[0].combination.reward < (maxEstimateReward + maxThreshold)) { continue; } selectedCombination = randomCombination; } Shuffle(linesForIndex); SlotLine resultLine = null; MatrixInWork newMatrix = startMatrix.Copy(); foreach (var curLine in linesForIndex) { if (CheckLineToPrint(curLine.lineConfig, symbolId, selectedCombination, newMatrix)) { PrintSymbolLineToMatrix(curLine.lineConfig, symbolId, selectedCombination, newMatrix); resultLine = curLine.lineConfig; break; } } if (resultLine == null) { return(SymbolStepResultType.LinesNotFound); } result.symbolId = symbolId; result.matrix = newMatrix; result.combination = selectedCombination; result.lineCombination = resultLine; result.currentReward = selectedCombination.reward; return(SymbolStepResultType.Success); }