コード例 #1
0
    public override PaylineGroup BuildPaylineGroup()
    {
        PaylineGroup paylines = new PaylineGroup();

        Payline payline1 = new Payline();

        payline1.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 0, Offset = 0
        });
        payline1.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 1, Offset = 0
        });
        payline1.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 2, Offset = 0
        });

        Payline payline2 = new Payline();

        payline2.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 0, Offset = 1
        });
        payline2.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 1, Offset = 1
        });
        payline2.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 2, Offset = 1
        });

        Payline payline3 = new Payline();

        payline3.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 0, Offset = 2
        });
        payline3.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 1, Offset = 2
        });
        payline3.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 2, Offset = 2
        });

        paylines.AddPayline(payline1);
        paylines.AddPayline(payline2);
        paylines.AddPayline(payline3);

        return(paylines);
    }
コード例 #2
0
ファイル: ScatterEvaluator.cs プロジェクト: lfwelove/GDK
        public SlotResult Evaluate(Paytable paytable, ReelWindow reelWindow, IRng rng)
        {
            if (paytable.ScatterComboGroup == null)
            {
                throw new Exception("ScatterEvaluator cannot evalate a paytable without a ScatterComboGroup");
            }

            SlotResult        result    = new SlotResult();
            ScattersComponent component = new ScattersComponent();

            List <PayCombo> payCombos = paytable.ScatterComboGroup.Combos;

            for (int combo = 0; combo < payCombos.Count; ++combo)
            {
                PayCombo payCombo      = payCombos[combo];
                int      bestPayAmount = 0;
                PayCombo bestPayCombo  = null;

                // TODO: This assumes the scatter combo contains one type of symbol only.
                // In almost all cases, this will be true so leaving it for now.
                bool   match  = false;
                Symbol symbol = payCombo.SymbolsInPayCombo[0];
                if (reelWindow.SymbolPositions.ContainsKey(symbol) &&
                    reelWindow.SymbolPositions[symbol].Count >= payCombo.SymbolsInPayCombo.Count)
                {
                    match = true;
                }

                if (match && (payCombo.PayAmount >= bestPayAmount))
                {
                    bestPayCombo  = payCombo;
                    bestPayAmount = payCombo.PayAmount;
                }

                if (bestPayCombo != null)
                {
                    // TODO: Might be able to optimize this but making PaylineCoord and SymbolPosition the same thing...
                    Payline payline = new Payline();
                    foreach (var position in reelWindow.SymbolPositions[symbol])
                    {
                        payline.AddPaylineCoord(new PaylineCoord {
                            ReelIndex = position.ReelIndex, Offset = position.ReelOffset
                        });
                    }
                    component.PayResults.Add(new PayResult {
                        PayCombo = bestPayCombo, Payline = payline
                    });
                    result.TotalWin += bestPayCombo.PayAmount;
                }
            }

            if (component.PayResults.Count > 0)
            {
                result.AddComponent <ScattersComponent>(component);
            }

            return(result);
        }
コード例 #3
0
    public void Init()
    {
        rng = new Rng();
        paylineEvaluator = new PaylineEvaluator();
        paytable         = new Paytable();

        // Reels
        ReelGroup reels = new ReelGroup();

        ReelStrip reel = new ReelStrip();

        reel.AddSymbol(new Symbol(0, "AA"));
        reel.AddSymbol(new Symbol(1, "BB"));
        reel.AddSymbol(new Symbol(2, "CC"));

        reels.AddReel(reel);
        reels.AddReel(reel);
        reels.AddReel(reel);
        reels.AddReel(reel);
        reels.AddReel(reel);

        // Paylines
        PaylineGroup paylines = new PaylineGroup();

        Payline payline1 = new Payline();

        payline1.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 0, Offset = 0
        });
        payline1.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 1, Offset = 0
        });
        payline1.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 2, Offset = 0
        });
        payline1.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 3, Offset = 0
        });
        payline1.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 4, Offset = 0
        });

        Payline payline2 = new Payline();

        payline2.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 0, Offset = 1
        });
        payline2.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 1, Offset = 1
        });
        payline2.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 2, Offset = 1
        });
        payline2.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 3, Offset = 1
        });
        payline2.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 4, Offset = 1
        });

        Payline payline3 = new Payline();

        payline3.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 0, Offset = 2
        });
        payline3.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 1, Offset = 2
        });
        payline3.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 2, Offset = 2
        });
        payline3.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 3, Offset = 2
        });
        payline3.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 4, Offset = 2
        });

        Payline payline4 = new Payline();

        payline4.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 0, Offset = 0
        });
        payline4.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 1, Offset = 1
        });
        payline4.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 2, Offset = 2
        });
        payline4.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 3, Offset = 1
        });
        payline4.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 4, Offset = 0
        });

        Payline payline5 = new Payline();

        payline5.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 0, Offset = 2
        });
        payline5.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 1, Offset = 1
        });
        payline5.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 2, Offset = 0
        });
        payline5.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 3, Offset = 1
        });
        payline5.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 4, Offset = 2
        });

        paylines.AddPayline(payline1);
        paylines.AddPayline(payline2);
        paylines.AddPayline(payline3);
        paylines.AddPayline(payline4);
        paylines.AddPayline(payline5);

        // PayCombos
        PayComboGroup payCombos = new PayComboGroup(new SymbolComparer());

        // AA
        payCombos.AddPayCombo(new PayCombo(new Symbol(0, "AA"), 5, 50));
        payCombos.AddPayCombo(new PayCombo(new Symbol(0, "AA"), 4, 25));
        payCombos.AddPayCombo(new PayCombo(new Symbol(0, "AA"), 3, 10));

        // BB
        payCombos.AddPayCombo(new PayCombo(new Symbol(1, "BB"), 5, 15));
        payCombos.AddPayCombo(new PayCombo(new Symbol(1, "BB"), 4, 10));
        payCombos.AddPayCombo(new PayCombo(new Symbol(1, "BB"), 3, 5));

        // CC
        payCombos.AddPayCombo(new PayCombo(new Symbol(2, "CC"), 5, 10));
        payCombos.AddPayCombo(new PayCombo(new Symbol(2, "CC"), 4, 5));
        payCombos.AddPayCombo(new PayCombo(new Symbol(2, "CC"), 3, 1));

        paytable.BaseGameReelGroup = reels;
        paytable.PaylineGroup      = paylines;
        paytable.PayComboGroup     = payCombos;
    }
コード例 #4
0
    public void Init()
    {
        rng = new Rng();
        paylineEvaluator = new PaylineEvaluator();
        paytable         = new Paytable();

        // Reels
        ReelGroup reels = new ReelGroup();

        ReelStrip reel = new ReelStrip();

        reel.AddSymbol(new Symbol(0, "AA"));
        reel.AddSymbol(new Symbol(1, "BB"));
        reel.AddSymbol(new Symbol(2, "CC"));

        reels.AddReel(reel);
        reels.AddReel(reel);
        reels.AddReel(reel);
        reels.AddReel(reel);
        reels.AddReel(reel);

        // Paylines
        PaylineGroup paylines = new PaylineGroup();

        Payline payline1 = new Payline();

        payline1.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 0, Offset = 0
        });
        payline1.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 1, Offset = 0
        });
        payline1.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 2, Offset = 0
        });
        payline1.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 3, Offset = 0
        });
        payline1.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 4, Offset = 0
        });

        Payline payline2 = new Payline();

        payline2.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 0, Offset = 1
        });
        payline2.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 1, Offset = 1
        });
        payline2.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 2, Offset = 1
        });
        payline2.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 3, Offset = 1
        });
        payline2.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 4, Offset = 1
        });

        Payline payline3 = new Payline();

        payline3.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 0, Offset = 2
        });
        payline3.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 1, Offset = 2
        });
        payline3.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 2, Offset = 2
        });
        payline3.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 3, Offset = 2
        });
        payline3.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 4, Offset = 2
        });

        Payline payline4 = new Payline();

        payline4.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 0, Offset = 0
        });
        payline4.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 1, Offset = 1
        });
        payline4.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 2, Offset = 2
        });
        payline4.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 3, Offset = 1
        });
        payline4.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 4, Offset = 0
        });

        Payline payline5 = new Payline();

        payline5.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 0, Offset = 2
        });
        payline5.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 1, Offset = 1
        });
        payline5.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 2, Offset = 0
        });
        payline5.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 3, Offset = 1
        });
        payline5.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 4, Offset = 2
        });

        paylines.AddPayline(payline1);
        paylines.AddPayline(payline2);
        paylines.AddPayline(payline3);
        paylines.AddPayline(payline4);
        paylines.AddPayline(payline5);

        // PayCombos
        ISymbolComparer comparer = new SymbolComparer();

        comparer.Substitute(new Symbol(0, "AA"), new Symbol(3, "MX"));
        comparer.Substitute(new Symbol(1, "BB"), new Symbol(3, "MX"));
        PayComboGroup payCombos = new PayComboGroup(comparer);

        // AA
        payCombos.AddPayCombo(new PayCombo(new Symbol(0, "AA"), 5, 200));
        payCombos.AddPayCombo(new PayCombo(new Symbol(0, "AA"), 4, 150));
        payCombos.AddPayCombo(new PayCombo(new Symbol(0, "AA"), 3, 100));

        // BB
        payCombos.AddPayCombo(new PayCombo(new Symbol(1, "BB"), 5, 175));
        payCombos.AddPayCombo(new PayCombo(new Symbol(1, "BB"), 4, 125));
        payCombos.AddPayCombo(new PayCombo(new Symbol(1, "BB"), 3, 85));

        // CC
        payCombos.AddPayCombo(new PayCombo(new Symbol(2, "CC"), 5, 130));
        payCombos.AddPayCombo(new PayCombo(new Symbol(2, "CC"), 4, 80));
        payCombos.AddPayCombo(new PayCombo(new Symbol(2, "CC"), 3, 30));

        // MX
        payCombos.AddPayCombo(new PayCombo(new Symbol(3, "MX"), 5, 44));
        payCombos.AddPayCombo(new PayCombo(new Symbol(3, "MX"), 4, 33));
        payCombos.AddPayCombo(new PayCombo(new Symbol(3, "MX"), 3, 22));

        paytable.BaseGameReelGroup = reels;
        paytable.PaylineGroup      = paylines;
        paytable.PayComboGroup     = payCombos;
    }
コード例 #5
0
    public void Init()
    {
        rng = new Rng();
        paylineEvaluator = new PaylineEvaluator();
        paytable         = new Paytable();

        // Reels
        ReelGroup reels = new ReelGroup();

        ReelStrip reel = new ReelStrip();

        reel.AddSymbol(new Symbol(0, "AA"));
        reel.AddSymbol(new Symbol(1, "BB"));
        reel.AddSymbol(new Symbol(2, "CC"));
        reel.AddSymbol(new Symbol(3, "WW"));

        reels.AddReel(reel);
        reels.AddReel(reel);
        reels.AddReel(reel);
        reels.AddReel(reel);
        reels.AddReel(reel);

        // Paylines
        PaylineGroup paylines = new PaylineGroup();

        Payline payline1 = new Payline();

        payline1.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 0, Offset = 0
        });
        payline1.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 1, Offset = 0
        });
        payline1.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 2, Offset = 0
        });
        payline1.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 3, Offset = 0
        });
        payline1.AddPaylineCoord(new PaylineCoord {
            ReelIndex = 4, Offset = 0
        });

        paylines.AddPayline(payline1);

        // PayCombos
        ISymbolComparer comparer = new SymbolComparer();

        comparer.Substitute(new Symbol(3, "WW"), new Symbol(0, "AA"));
        comparer.Substitute(new Symbol(3, "WW"), new Symbol(0, "BB"));
        comparer.Substitute(new Symbol(3, "WW"), new Symbol(0, "CC"));
        PayComboGroup payCombos = new PayComboGroup(comparer);

        // WW
        payCombos.AddPayCombo(new PayCombo(new Symbol(3, "WW"), 5, 1000));
        payCombos.AddPayCombo(new PayCombo(new Symbol(3, "WW"), 4, 500));
        payCombos.AddPayCombo(new PayCombo(new Symbol(3, "WW"), 3, 100));

        // AA
        payCombos.AddPayCombo(new PayCombo(new Symbol(0, "AA"), 5, 50));
        payCombos.AddPayCombo(new PayCombo(new Symbol(0, "AA"), 4, 25));
        payCombos.AddPayCombo(new PayCombo(new Symbol(0, "AA"), 3, 10));

        // BB
        payCombos.AddPayCombo(new PayCombo(new Symbol(1, "BB"), 5, 15));
        payCombos.AddPayCombo(new PayCombo(new Symbol(1, "BB"), 4, 10));
        payCombos.AddPayCombo(new PayCombo(new Symbol(1, "BB"), 3, 5));

        // CC
        payCombos.AddPayCombo(new PayCombo(new Symbol(2, "CC"), 5, 10));
        payCombos.AddPayCombo(new PayCombo(new Symbol(2, "CC"), 4, 5));
        payCombos.AddPayCombo(new PayCombo(new Symbol(2, "CC"), 3, 1));

        paytable.BaseGameReelGroup = reels;
        paytable.PaylineGroup      = paylines;
        paytable.PayComboGroup     = payCombos;
    }