private void TestChows(IList <Tile> handTiles, Tile discardTile, MeldSide side, IList <OutTurnOperation> operations) { if (!gameSettings.AllowChows) { return; } if (side != MeldSide.Left) { return; } var chows = MahjongLogic.GetChows(handTiles, discardTile, side); if (chows.Any()) { foreach (var chow in chows) { operations.Add(new OutTurnOperation { Type = OutTurnOperationType.Chow, Tile = discardTile, Meld = chow, ForbiddenTiles = gameSettings.AllowDiscardSameAfterOpen ? null : chow.GetForbiddenTiles(discardTile) }); } } }
public static void TestChows() { var handTiles = new List <Tile> { new Tile(Suit.M, 1), new Tile(Suit.M, 2), new Tile(Suit.M, 3), new Tile(Suit.M, 4), new Tile(Suit.M, 4), new Tile(Suit.M, 5), new Tile(Suit.M, 5), new Tile(Suit.M, 5, true), new Tile(Suit.M, 6) }; var result = MahjongLogic.GetChows(handTiles, new Tile(Suit.M, 4), MeldSide.Left); Debug.Log($"Melds: {string.Join(",", result)}"); handTiles = new List <Tile> { new Tile(Suit.M, 1), new Tile(Suit.M, 2), new Tile(Suit.M, 3), new Tile(Suit.M, 4), new Tile(Suit.M, 4), new Tile(Suit.M, 5), new Tile(Suit.M, 5), new Tile(Suit.M, 5), new Tile(Suit.M, 6) }; result = MahjongLogic.GetChows(handTiles, new Tile(Suit.M, 5, true), MeldSide.Opposite); Debug.Log($"Melds: {string.Join(",", result)}"); }