public void IsNorthTest() { var(playerWind, roundWind) = (NORTH, EAST); var tiles = Tiles34.Parse(man: "23422", sou: "234567", honors: "444"); IsTrue(new YakuhaiNorth().IsConditionMet(Hand(tiles), new object[] { playerWind, roundWind })); var tiles_ = TileIds.Parse(man: "23422", sou: "234567", honors: "444"); var winTile = TileId.Parse(honors: "4"); var result = EstimateHandValue(tiles_, winTile, config: new HandConfig( isTsumo: false, isRiichi: false, playerWind: playerWind, roundWind: roundWind)); AreEqual(null, result.Error); AreEqual(1, result.Han); AreEqual(40, result.Fu); AreEqual(1, result.Yaku.Count); roundWind = NORTH; result = EstimateHandValue(tiles_, winTile, config: new HandConfig( isTsumo: false, isRiichi: false, playerWind: playerWind, roundWind: roundWind)); AreEqual(null, result.Error); AreEqual(2, result.Han); AreEqual(40, result.Fu); AreEqual(2, result.Yaku.Count); }
public void PenchanFuTest() { var config = new HandConfig(); var tiles = TileIds.Parse(man: "123456", pin: "55", sou: "12456"); var winTile = TileId.Parse(sou: "3"); var hand = Hand(new TileIds(tiles.Append(winTile)).ToTiles34()); var(fuDetails, fu) = CalculateFu(hand, winTile, GetWinGroup(hand, winTile), config); AreEqual(2, fuDetails.Count); IsTrue(fuDetails.Contains(new FuDetail(30, BASE))); IsTrue(fuDetails.Contains(new FuDetail(2, PENCHAN))); AreEqual(fu, 40); tiles = TileIds.Parse(man: "123456", pin: "55", sou: "34589"); winTile = TileId.Parse(sou: "7"); hand = Hand(new TileIds(tiles.Append(winTile)).ToTiles34()); (fuDetails, fu) = CalculateFu(hand, winTile, GetWinGroup(hand, winTile), config); AreEqual(2, fuDetails.Count); IsTrue(fuDetails.Contains(new FuDetail(30, BASE))); IsTrue(fuDetails.Contains(new FuDetail(2, PENCHAN))); AreEqual(fu, 40); }
public void ClosedHonorPonFuTest() { var config = new HandConfig(); var tiles = TileIds.Parse(man: "123456", sou: "1178", honors: "111"); var winTile = TileId.Parse(sou: "6"); var hand = Hand(new TileIds(tiles.Append(winTile)).ToTiles34()); var(fuDetails, fu) = CalculateFu(hand, winTile, GetWinGroup(hand, winTile), config); AreEqual(2, fuDetails.Count); IsTrue(fuDetails.Contains(new FuDetail(30, BASE))); IsTrue(fuDetails.Contains(new FuDetail(8, CLOSED_TERMINAL_PON))); AreEqual(fu, 40); tiles = TileIds.Parse(man: "123456", sou: "11678", honors: "11"); winTile = TileId.Parse(honors: "1"); hand = Hand(new TileIds(tiles.Append(winTile)).ToTiles34()); (fuDetails, fu) = CalculateFu(hand, winTile, GetWinGroup(hand, winTile), config); AreEqual(2, fuDetails.Count); IsTrue(fuDetails.Contains(new FuDetail(30, BASE))); IsTrue(fuDetails.Contains(new FuDetail(4, OPEN_TERMINAL_PON))); AreEqual(fu, 40); }
public void IsRyanpeikouTest() { var tiles = Tiles34.Parse(man: "22", pin: "223344", sou: "112233"); IsTrue(new Ryanpeikou().IsConditionMet(Hand(tiles, 1))); tiles = Tiles34.Parse(man: "22", sou: "111122223333"); IsTrue(new Ryanpeikou().IsConditionMet(Hand(tiles, 1))); tiles = Tiles34.Parse(man: "123", pin: "23444", sou: "112233"); IsFalse(new Ryanpeikou().IsConditionMet(Hand(tiles))); var tiles_ = TileIds.Parse(man: "33", pin: "223344", sou: "112233"); var winTile = TileId.Parse(pin: "3"); var result = EstimateHandValue(tiles_, winTile); AreEqual(null, result.Error); AreEqual(3, result.Han); AreEqual(40, result.Fu); AreEqual(1, result.Yaku.Count); var melds = new List <Meld> { MakeMeld(MeldType.CHI, sou: "123") }; result = EstimateHandValue(tiles_, winTile, melds); AreNotEqual(null, result.Error); }
public void IsRenhouYakumanTest() { var tiles = TileIds.Parse(man: "234456", pin: "66", sou: "123444"); var winTile = TileId.Parse(sou: "4"); var result = EstimateHandValue(tiles, winTile, config: new HandConfig(isRenhou: true, options: new OptionalRules(renhouAsYakuman: true))); AreEqual(null, result.Error); AreEqual(13, result.Han); AreEqual(1, result.Yaku.Count); }
public void IsNotDaisharinTest() { var tiles = TileIds.Parse(pin: "22334455667788"); var winTile = TileId.Parse(pin: "8"); var result = EstimateHandValue(tiles, winTile); AreEqual(null, result.Error); AreEqual(11, result.Han); AreEqual(4, result.Yaku.Count); }
public void IsChiihouTest() { var tiles = TileIds.Parse(man: "234456", pin: "66", sou: "123444"); var winTile = TileId.Parse(sou: "4"); var result = EstimateHandValue(tiles, winTile, config: new HandConfig(isChiihou: true)); AreEqual(null, result.Error); AreEqual(13, result.Han); AreEqual(40, result.Fu); AreEqual(1, result.Yaku.Count); }
public void SixtupleYakumanTest() { var tiles = TileIds.Parse(honors: "11122233344455"); var winTile = TileId.Parse(honors: "5"); var config = new HandConfig(isTenhou: true); var result = EstimateHandValue(tiles, winTile, config: config); AreEqual(null, result.Error); AreEqual(78, result.Han); AreEqual(192000, result.Cost.Main); }
public void IsDaisharinTest() { var tiles = TileIds.Parse(pin: "22334455667788"); var winTile = TileId.Parse(pin: "8"); var result = EstimateHandValue(tiles, winTile, config: new HandConfig(options: new OptionalRules(hasDaisharin: true))); AreEqual(null, result.Error); AreEqual(13, result.Han); AreEqual(1, result.Yaku.Count); AreEqual("Daisharin", result.Yaku[0].Name); }
public void IsIppatsuTest() { var tiles = TileIds.Parse(man: "234456", pin: "66", sou: "123444"); var winTile = TileId.Parse(sou: "4"); var result = EstimateHandValue(tiles, winTile, config: new HandConfig(isRiichi: true, isIppatsu: true)); AreEqual(null, result.Error); AreEqual(2, result.Han); AreEqual(40, result.Fu); AreEqual(2, result.Yaku.Count); result = EstimateHandValue(tiles, winTile, config: new HandConfig(isRiichi: false, isIppatsu: true)); AreNotEqual(null, result.Error); }
public void OpenHandWithoutAdditionalFuTest() { var tiles = TileIds.Parse(man: "234567", pin: "22", sou: "234678"); var winTile = TileId.Parse(sou: "6"); var melds = new List <Meld> { MakeMeld(MeldType.CHI, sou: "234") }; var config = new HandConfig(options: new OptionalRules(hasOpenTanyao: true, fuForOpenPinfu: false)); var result = EstimateHandValue(tiles, winTile, melds, config: config); AreEqual(1, result.Han); AreEqual(20, result.Fu); AreEqual(700, result.Cost.Main); }
public void IsAgariAndClosedKanTest() { var tiles = TileIds.Parse(man: "45666777", pin: "111", honors: "222"); var winTile = TileId.Parse(man: "4"); var melds = new List <Meld> { MakeMeld(MeldType.PON, pin: "111"), MakeMeld(MeldType.KAN, man: "6666", isOpen: false), MakeMeld(MeldType.PON, man: "777") }; var result = EstimateHandValue(tiles, winTile, melds); AreNotEqual(null, result.Error); }
protected override void Awake() { base.Awake(); // Search through custom elevation data directory to find individual elevation tiles. // Record which TileIds are present for use in HasElevationTile. var elevationDataFiles = Directory.GetFiles(ElevationDataDirectory, "*.et"); foreach (var elevationDataFile in elevationDataFiles) { var tileId = TileId.Parse(Path.GetFileNameWithoutExtension(elevationDataFile)); _tiles.Add(tileId); } }
public void TsumoHandBaseTest() { var config = new HandConfig(isTsumo: true); var tiles = TileIds.Parse(man: "123456", pin: "11", sou: "22278"); var winTile = TileId.Parse(sou: "6"); var hand = Hand(new TileIds(tiles.Append(winTile)).ToTiles34()); var(fuDetails, _) = CalculateFu(hand, winTile, GetWinGroup(hand, winTile), config); IsTrue(fuDetails.Contains(new FuDetail(20, BASE))); }
public void IsDaisuushiTest() { var tiles = Tiles34.Parse(sou: "22", honors: "111222333444"); IsTrue(new DaiSuushi().IsConditionMet(Hand(tiles))); var tiles_ = TileIds.Parse(sou: "22", honors: "111222333444"); var winTile = TileId.Parse(honors: "4"); var result = EstimateHandValue(tiles_, winTile); AreEqual(null, result.Error); AreEqual(26, result.Han); AreEqual(60, result.Fu); AreEqual(1, result.Yaku.Count); }
public void IsRyuisouTest() { var tiles = Tiles34.Parse(sou: "22334466888", honors: "666"); IsTrue(new Ryuuiisou().IsConditionMet(Hand(tiles))); var tiles_ = TileIds.Parse(sou: "22334466888", honors: "666"); var winTile = TileId.Parse(honors: "6"); var result = EstimateHandValue(tiles_, winTile); AreEqual(null, result.Error); AreEqual(13, result.Han); AreEqual(40, result.Fu); AreEqual(1, result.Yaku.Count); }
public void IsDaisangenTest() { var tiles = Tiles34.Parse(man: "22", sou: "123", honors: "555666777"); IsTrue(new Daisangen().IsConditionMet(Hand(tiles))); var tiles_ = TileIds.Parse(man: "22", sou: "123", honors: "555666777"); var winTile = TileId.Parse(honors: "7"); var result = EstimateHandValue(tiles_, winTile); AreEqual(null, result.Error); AreEqual(13, result.Han); AreEqual(50, result.Fu); AreEqual(1, result.Yaku.Count); }
public void KokushimusouMultipleYakuman() { var tiles = TileIds.Parse(man: "19", pin: "19", sou: "19", honors: "12345677"); var winTile = TileId.Parse(honors: "1"); var handConfig = new HandConfig(isTsumo: true, isTenhou: true, isChiihou: false); var handCalculation = EstimateHandValue(tiles, winTile, config: handConfig); AreEqual(null, handCalculation.Error); AreEqual(2, handCalculation.Yaku.Count); IsTrue(handCalculation.Yaku.Any(x => x.GetType() == typeof(KokushiMusou))); IsFalse(handCalculation.Yaku.Any(x => x.GetType() == typeof(DaburuKokushiMusou))); IsTrue(handCalculation.Yaku.Any(x => x.GetType() == typeof(Tenhou))); IsFalse(handCalculation.Yaku.Any(x => x.GetType() == typeof(Chiihou))); AreEqual(26, handCalculation.Han); }
public void IsChinrotoTest() { var tiles = Tiles34.Parse(man: "111999", pin: "99", sou: "111999"); IsTrue(new Chinroutou().IsConditionMet(Hand(tiles))); var tiles_ = TileIds.Parse(man: "111999", pin: "99", sou: "111222"); var winTile = TileId.Parse(pin: "9"); var result = EstimateHandValue(tiles_, winTile); AreEqual(null, result.Error); AreEqual(26, result.Han); AreEqual(60, result.Fu); AreEqual(1, result.Yaku.Count); }
public void IsChunTest() { var tiles = Tiles34.Parse(man: "23422", sou: "234567", honors: "777"); IsTrue(new Chun().IsConditionMet(Hand(tiles))); var tiles_ = TileIds.Parse(man: "23422", sou: "234567", honors: "777"); var winTile = TileId.Parse(honors: "7"); var result = EstimateHandValue(tiles_, winTile, config: new HandConfig(isTsumo: false, isRiichi: false)); AreEqual(null, result.Error); AreEqual(1, result.Han); AreEqual(40, result.Fu); AreEqual(1, result.Yaku.Count); }
public void ChitoitsuFuTest() { var config = new HandConfig(); var tiles = TileIds.Parse(man: "115599", pin: "6", sou: "112244"); var winTile = TileId.Parse(pin: "6"); var hand = Hand(new TileIds(tiles.Append(winTile)).ToTiles34()); var(fuDetails, fu) = CalculateFu(hand, winTile, GetWinGroup(hand, winTile), config); AreEqual(1, fuDetails.Count); IsTrue(fuDetails.Contains(new FuDetail(25, BASE))); AreEqual(fu, 25); }
public void PairWaitFu() { var config = new HandConfig(); var tiles = TileIds.Parse(man: "123456", pin: "1", sou: "123678"); var winTile = TileId.Parse(pin: "1"); var hand = Hand(new TileIds(tiles.Append(winTile)).ToTiles34()); var(fuDetails, fu) = CalculateFu(hand, winTile, GetWinGroup(hand, winTile), config); AreEqual(2, fuDetails.Count); IsTrue(fuDetails.Contains(new FuDetail(30, BASE))); IsTrue(fuDetails.Contains(new FuDetail(2, PAIR_WAIT))); AreEqual(fu, 40); }
public void ClosedPonFuTest() { var config = new HandConfig(); var tiles = TileIds.Parse(man: "123456", pin: "11", sou: "22278"); var winTile = TileId.Parse(sou: "6"); var hand = Hand(new TileIds(tiles.Append(winTile)).ToTiles34()); var(fuDetails, fu) = CalculateFu(hand, winTile, GetWinGroup(hand, winTile), config); AreEqual(2, fuDetails.Count); IsTrue(fuDetails.Contains(new FuDetail(30, BASE))); IsTrue(fuDetails.Contains(new FuDetail(4, CLOSED_PON))); AreEqual(fu, 40); }
public void IsTsumoTest() { var tiles = TileIds.Parse(man: "234456", pin: "66", sou: "123444"); var winTile = TileId.Parse(sou: "4"); var result = EstimateHandValue(tiles, winTile, config: new HandConfig(isTsumo: true)); AreEqual(null, result.Error); AreEqual(1, result.Han); AreEqual(30, result.Fu); AreEqual(1, result.Yaku.Count); var melds = new List <Meld> { MakeMeld(MeldType.CHI, sou: "123") }; result = EstimateHandValue(tiles, winTile, melds, config: new HandConfig(isTsumo: true)); AreNotEqual(null, result.Error); }
public void IsChitoitsuHandTest() { var tiles = Tiles34.Parse(man: "113355", pin: "11", sou: "113355"); IsTrue(new Chiitoitsu().IsConditionMet(Hand(tiles))); tiles = Tiles34.Parse(man: "2299", pin: "1199", sou: "2299", honors: "44"); IsTrue(new Chiitoitsu().IsConditionMet(Hand(tiles))); var tiles_ = TileIds.Parse(man: "113355", pin: "11", sou: "113355"); var winTile = TileId.Parse(pin: "1"); var result = EstimateHandValue(tiles_, winTile); AreEqual(null, result.Error); AreEqual(2, result.Han); AreEqual(25, result.Fu); AreEqual(1, result.Yaku.Count); }
public void TsumoAndDisabledPinfuTest() { var config = new HandConfig(isTsumo: true, options: new OptionalRules(fuForPinfuTsumo: true)); var tiles = TileIds.Parse(man: "123456", pin: "123", sou: "2278"); var winTile = TileId.Parse(sou: "6"); var hand = Hand(new TileIds(tiles.Append(winTile)).ToTiles34()); var(fuDetails, fu) = CalculateFu(hand, winTile, GetWinGroup(hand, winTile), config); AreEqual(2, fuDetails.Count); IsTrue(fuDetails.Contains(new FuDetail(20, BASE))); IsTrue(fuDetails.Contains(new FuDetail(2, TSUMO))); AreEqual(fu, 30); }
public void IsTanyaoTest() { var tiles = Tiles34.Parse(man: "234567", pin: "22", sou: "234567"); IsTrue(new Tanyao().IsConditionMet(Hand(tiles))); tiles = Tiles34.Parse(man: "234567", pin: "22", sou: "123456"); IsFalse(new Tanyao().IsConditionMet(Hand(tiles))); tiles = Tiles34.Parse(man: "234567", sou: "234567", honors: "22"); IsFalse(new Tanyao().IsConditionMet(Hand(tiles))); var tiles_ = TileIds.Parse(man: "234567", pin: "22", sou: "234567"); var winTile = TileId.Parse(man: "7"); var result = EstimateHandValue(tiles_, winTile, config: new HandConfig(isTsumo: false, isRiichi: true)); AreEqual(null, result.Error); AreEqual(3, result.Han); AreEqual(30, result.Fu); AreEqual(3, result.Yaku.Count); tiles_ = TileIds.Parse(man: "234567", pin: "22", sou: "234567"); winTile = TileId.Parse(man: "7"); var melds = new List <Meld> { MakeMeld(MeldType.CHI, sou: "234") }; result = EstimateHandValue( tiles_, winTile, melds, config: new HandConfig(options: new OptionalRules(hasOpenTanyao: true))); AreEqual(null, result.Error); AreEqual(1, result.Han); AreEqual(30, result.Fu); AreEqual(1, result.Yaku.Count); tiles_ = TileIds.Parse(man: "234567", pin: "22", sou: "234567"); winTile = TileId.Parse(man: "7"); melds = new List <Meld> { MakeMeld(MeldType.CHI, sou: "234") }; result = EstimateHandValue( tiles_, winTile, melds, config: new HandConfig(options: new OptionalRules(hasOpenTanyao: false))); AreNotEqual(null, result.Error); }
public void IsSanankouTest() { var tiles = Tiles34.Parse(man: "333", pin: "44555", sou: "111444"); var winTile = TileId.Parse(sou: "4"); var melds = new List <Meld> { MakeMeld(MeldType.PON, sou: "111"), MakeMeld(MeldType.PON, sou: "444") }; IsFalse(new Sanankou().IsConditionMet(Hand(tiles), new object[] { winTile, melds, false })); melds = new List <Meld> { MakeMeld(MeldType.PON, sou: "111") }; IsFalse(new Sanankou().IsConditionMet(Hand(tiles), new object[] { winTile, melds, false })); IsTrue(new Sanankou().IsConditionMet(Hand(tiles), new object[] { winTile, melds, true })); tiles = Tiles34.Parse(pin: "444789999", honors: "22333"); winTile = TileId.Parse(pin: "9"); IsTrue(new Sanankou().IsConditionMet(Hand(tiles), new object[] { winTile, new List <Meld>(), false })); melds = new List <Meld> { MakeMeld(MeldType.CHI, pin: "456") }; tiles = Tiles34.Parse(pin: "222456666777", honors: "77"); winTile = TileId.Parse(pin: "6"); IsFalse(new Sanankou().IsConditionMet(Hand(tiles), new object[] { winTile, melds, false })); var tiles_ = TileIds.Parse(man: "333", pin: "44555", sou: "123444"); melds = new List <Meld> { MakeMeld(MeldType.CHI, sou: "123") }; winTile = TileId.Parse(pin: "5"); var result = EstimateHandValue(tiles_, winTile, melds, config: new HandConfig(isTsumo: true)); AreEqual(null, result.Error); AreEqual(2, result.Han); AreEqual(40, result.Fu); AreEqual(1, result.Yaku.Count); }
public void IsSanshokuDoukouTest() { var tiles = Tiles34.Parse(man: "111", pin: "11145677", sou: "111"); IsTrue(new SanshokuDoukou().IsConditionMet(Hand(tiles))); tiles = Tiles34.Parse(man: "222", pin: "33344455", sou: "111"); IsFalse(new SanshokuDoukou().IsConditionMet(Hand(tiles))); var tiles_ = TileIds.Parse(man: "222", pin: "22245699", sou: "222"); var winTile = TileId.Parse(pin: "9"); var melds = new List <Meld> { MakeMeld(MeldType.PON, sou: "222") }; var result = EstimateHandValue(tiles_, winTile, melds); AreEqual(null, result.Error); AreEqual(2, result.Han); AreEqual(40, result.Fu); AreEqual(1, result.Yaku.Count); }
public void IsTsuisouTest() { var tiles = Tiles34.Parse(honors: "11122233366677"); IsTrue(new Tsuuiisou().IsConditionMet(Hand(tiles))); tiles = Tiles34.Parse(honors: "11223344556677"); IsTrue(new Tsuuiisou().IsConditionMet(Hand(tiles))); tiles = Tiles34.Parse(honors: "1133445577", pin: "88", sou: "11"); IsFalse(new Tsuuiisou().IsConditionMet(Hand(tiles))); var tiles_ = TileIds.Parse(honors: "11223344556677"); var winTile = TileId.Parse(honors: "7"); var result = EstimateHandValue(tiles_, winTile); AreEqual(null, result.Error); AreEqual(13, result.Han); AreEqual(25, result.Fu); AreEqual(1, result.Yaku.Count); }