public void SomeHandsByRon(string handString, int roundWind, int seatWind, string discardString, Yaku expectedYaku)
        {
            var parser = new ShorthandParser(handString);
            var tiles  = parser.Tiles.Select(t => Tile.FromTileType(t, 0)).ToList();
            var melds  = new List <State.Meld>();

            foreach (var meld in parser.Melds)
            {
                var meldTiles = meld.Tiles.Select(t => Tile.FromTileType(t, 0)).ToList();
                if (meld.MeldId < 8)
                {
                    melds.Add(State.Meld.Chii(meldTiles, meldTiles.First()));
                }
                else if (meld.MeldId < 7 + 9)
                {
                    melds.Add(State.Meld.Pon(meldTiles, meldTiles.First()));
                }
                else
                {
                    melds.Add(State.Meld.Ankan(meld.Tiles.First()));
                }
            }

            var winningTile = TileType.FromString(discardString);

            var(yaku, fu) = ClassicScoreCalculator.Ron(winningTile, roundWind, seatWind, melds, tiles);

            Assert.Equal(expectedYaku, yaku);
        }
Esempio n. 2
0
        public void SomeHandByTsumo(string handString, int roundWind, int seatWind, string discardString, Yaku expectedYaku)
        {
            var discard = TileType.FromString(discardString);
            var sp      = new ShorthandParser(handString);
            var hand    = new HandCalculator(sp);
            var wind    = new WindScoringData(roundWind, seatWind);

            var(yaku, fu) = ScoreCalculator.TsumoWithYaku(hand.ScoringData, wind, discard);

            Assert.Equal(expectedYaku, yaku);
        }
Esempio n. 3
0
        public void HighestUkeIreDiscard(string hand, string expectedTileType)
        {
            var expected = TileType.FromString(expectedTileType).TileTypeId;

            var parser = new ShorthandParser(hand);
            var c      = new UkeIreCalculator(parser);

            var actual = c.GetHighestUkeIreDiscard();

            Assert.Equal(expected, actual);
        }
Esempio n. 4
0
        public void TotalFuTsumo(string handString, int roundWind, int seatWind, string drawString, int expectedFu)
        {
            var draw = TileType.FromString(drawString);
            var sp   = new ShorthandParser(handString);
            var hand = new HandCalculator(sp);
            var wind = new WindScoringData(roundWind, seatWind);

            var(han, fu) = ScoreCalculator.Tsumo(hand.ScoringData, wind, draw);

            Assert.Equal(expectedFu, fu);
        }