Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }