Beispiel #1
0
    public void ReelWindow_SymbolPositions()
    {
        reels = new ReelGroup();

        ReelStrip reel1 = new ReelStrip();

        reel1.AddSymbol(new Symbol(0, "AA"));
        reel1.AddSymbol(new Symbol(1, "BB"));
        reel1.AddSymbol(new Symbol(2, "CC"));
        reel1.AddSymbol(new Symbol(3, "DD"));
        reel1.AddSymbol(new Symbol(4, "EE"));

        reels.AddReel(reel1);
        reels.AddReel(reel1);
        reels.AddReel(reel1);
        reels.AddReel(reel1);
        reels.AddReel(reel1);

        ReelWindow reelWindow = new ReelWindow(reels, new List <int> {
            0, 0, 0, 0, 0
        });

        List <SymbolPosition> positions = reelWindow.SymbolPositions[new Symbol(0, "AA")];

        Assert.AreEqual(5, positions.Count);

        Assert.AreEqual(0, positions[0].ReelIndex);
        Assert.AreEqual(0, positions[0].ReelOffset);
        Assert.AreEqual(4, positions[4].ReelIndex);
        Assert.AreEqual(0, positions[4].ReelOffset);
    }
Beispiel #2
0
    public override ReelGroup BuildBGReelGroup()
    {
        ReelGroup reels = new ReelGroup();

        ReelStrip reel1 = new ReelStrip();

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

        ReelStrip reel2 = new ReelStrip();

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

        ReelStrip reel3 = new ReelStrip();

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

        reels.AddReel(reel1);
        reels.AddReel(reel2);
        reels.AddReel(reel3);

        return(reels);
    }
Beispiel #3
0
    public void ReelWindow_LessThanDefaultHeight()
    {
        reels = new ReelGroup();

        ReelStrip reel1 = new ReelStrip();

        reel1.AddSymbol(new Symbol(0, "AA"));

        ReelStrip reel2 = new ReelStrip();

        reel2.AddSymbol(new Symbol(1, "BB"));

        ReelStrip reel3 = new ReelStrip();

        reel3.AddSymbol(new Symbol(2, "CC"));

        reels.AddReel(reel1);
        reels.AddReel(reel2);
        reels.AddReel(reel3);

        ReelWindow reelWindow = new ReelWindow(reels, new List <int> {
            0, 0, 0
        });
        List <List <Symbol> > window = reelWindow.Window;

        Assert.AreEqual(3, window.Count);

        Assert.AreEqual(1, window[0].Count);
        Assert.AreEqual(1, window[1].Count);
        Assert.AreEqual(1, window[2].Count);

        Assert.AreEqual("AA", window[0][0].Name);
        Assert.AreEqual("BB", window[1][0].Name);
        Assert.AreEqual("CC", window[2][0].Name);
    }
 public ReelStrips(ReelStripJsonContainer json)
 {
     realStrips = new ReelStrip[json.ReelStrips.Count];
     for (int i = 0; i < realStrips.Length; i++)
     {
         realStrips[i] = new ReelStrip(json.ReelStrips[i]);
     }
 }
Beispiel #5
0
    public void ReelWindow_SpecifiedHeight()
    {
        reels = new ReelGroup();

        ReelStrip reel1 = new ReelStrip();

        reel1.AddSymbol(new Symbol(0, "AA"));
        reel1.AddSymbol(new Symbol(1, "BB"));
        reel1.AddSymbol(new Symbol(2, "CC"));
        reel1.AddSymbol(new Symbol(3, "DD"));
        reel1.AddSymbol(new Symbol(4, "EE"));

        reels.AddReel(reel1, 5);

        ReelWindow reelWindow = new ReelWindow(reels, new List <int> {
            0
        });
        List <List <Symbol> > window = reelWindow.Window;

        Assert.AreEqual(5, window[0].Count);
    }
Beispiel #6
0
    public void ReelWindow_CorrectSymbols()
    {
        reels = new ReelGroup();

        ReelStrip reel1 = new ReelStrip();

        reel1.AddSymbol(new Symbol(0, "AA"));
        reel1.AddSymbol(new Symbol(1, "BB"));
        reel1.AddSymbol(new Symbol(2, "CC"));
        reel1.AddSymbol(new Symbol(3, "DD"));
        reel1.AddSymbol(new Symbol(4, "EE"));

        reels.AddReel(reel1);

        ReelWindow reelWindow = new ReelWindow(reels, new List <int> {
            0
        });
        List <List <Symbol> > window = reelWindow.Window;

        ReelStrip expected = new ReelStrip();

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

        CollectionAssert.AreEqual(expected.Symbols, window[0]);

        reelWindow.UpdateReelWindow(reels, new List <int> {
            1
        });
        window = reelWindow.Window;

        expected = new ReelStrip();
        expected.AddSymbol(new Symbol(1, "BB"));
        expected.AddSymbol(new Symbol(2, "CC"));
        expected.AddSymbol(new Symbol(3, "DD"));

        CollectionAssert.AreEqual(expected.Symbols, window[0]);

        reelWindow.UpdateReelWindow(reels, new List <int> {
            2
        });
        window = reelWindow.Window;

        expected = new ReelStrip();
        expected.AddSymbol(new Symbol(2, "CC"));
        expected.AddSymbol(new Symbol(3, "DD"));
        expected.AddSymbol(new Symbol(4, "EE"));

        CollectionAssert.AreEqual(expected.Symbols, window[0]);

        reelWindow.UpdateReelWindow(reels, new List <int> {
            3
        });
        window = reelWindow.Window;

        expected = new ReelStrip();
        expected.AddSymbol(new Symbol(3, "DD"));
        expected.AddSymbol(new Symbol(4, "EE"));
        expected.AddSymbol(new Symbol(0, "AA"));

        CollectionAssert.AreEqual(expected.Symbols, window[0]);

        reelWindow.UpdateReelWindow(reels, new List <int> {
            4
        });
        window = reelWindow.Window;

        expected = new ReelStrip();
        expected.AddSymbol(new Symbol(4, "EE"));
        expected.AddSymbol(new Symbol(0, "AA"));
        expected.AddSymbol(new Symbol(1, "BB"));

        CollectionAssert.AreEqual(expected.Symbols, window[0]);

        reelWindow.UpdateReelWindow(reels, new List <int> {
            5
        });
        window = reelWindow.Window;

        expected = new ReelStrip();
        expected.AddSymbol(new Symbol(0, "AA"));
        expected.AddSymbol(new Symbol(1, "BB"));
        expected.AddSymbol(new Symbol(2, "CC"));

        CollectionAssert.AreEqual(expected.Symbols, window[0]);
    }
Beispiel #7
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;
    }
Beispiel #8
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;
    }
Beispiel #9
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;
    }
Beispiel #10
0
    /// <summary>
    /// The theme specific game evaluation logic.
    /// </summary>
    public SlotResults RunOneGame(int bet)
    {
        // Create the slot results.
        SlotResults slotResults = new SlotResults();

        // Create the evaluators for the base game.
        PaylineEvaluator bgPaylineEval = new PaylineEvaluator();
        ScatterEvaluator bgScatterEval = new ScatterEvaluator();

        // Create the evaluators for the free games.
        PaylineEvaluator fgPaylineEval = new PaylineEvaluator();
        ScatterEvaluator fgScatterEval = new ScatterEvaluator();

        // Generate the random numbers.
        List <int> randomNumbers = new List <int>();

        for (int reel = 0; reel < paytable.BaseGameReelGroup.Reels.Count; ++reel)
        {
            ReelStrip reelStrip = paytable.BaseGameReelGroup.Reels[reel].ReelStrip;
            randomNumbers.Add(rng.GetRandomNumber(reelStrip.Symbols.Count));
        }

        ReelWindow reelWindow = new ReelWindow(paytable.BaseGameReelGroup, randomNumbers);

        // Evaluate the base game (payline and scatter evaluation).
        SlotResult paylineResults = bgPaylineEval.Evaluate(paytable, reelWindow, rng);
        SlotResult scatterResults = bgScatterEval.Evaluate(paytable, reelWindow, rng);

        slotResults.Results.Add(paylineResults);
        slotResults.Results.Add(scatterResults);

        slotResults.TotalWin += paylineResults.TotalWin;
        slotResults.TotalWin += scatterResults.TotalWin;

        // Evaluate the free games (if any).
        if (scatterResults.GetComponent <ScattersComponent>() != null)
        {
            // Add total number of free games.
            int freeGamesAwarded = 5;

            for (int i = 0; i < freeGamesAwarded; ++i)
            {
                // Generate the random numbers.
                randomNumbers = new List <int>();
                for (int reel = 0; reel < paytable.FreeGamesReelGroup.Reels.Count; ++reel)
                {
                    ReelStrip reelStrip = paytable.FreeGamesReelGroup.Reels[reel].ReelStrip;
                    randomNumbers.Add(rng.GetRandomNumber(reelStrip.Symbols.Count));
                }

                reelWindow = new ReelWindow(paytable.FreeGamesReelGroup, randomNumbers);

                // Evaluate the free game (payline and scatter evaluation).
                SlotResult fgPaylineResults = fgPaylineEval.Evaluate(paytable, reelWindow, rng);
                SlotResult fgScatterResults = fgScatterEval.Evaluate(paytable, reelWindow, rng);
                slotResults.Results.Add(fgPaylineResults);
                slotResults.Results.Add(fgScatterResults);

                slotResults.TotalWin += paylineResults.TotalWin;
                slotResults.TotalWin += scatterResults.TotalWin;
            }
        }

        return(slotResults);
    }