private static void PrintHandResult(TileIds tiles, TileId winTile, List <Meld> melds, HandResponse result) { Console.WriteLine($"{tiles.ToOneLineString()}"); var IsOpened = false; if (melds is null) { Console.WriteLine("鳴きなし"); } else { foreach (var meldItem in melds) { Console.WriteLine(meldItem); } IsOpened = melds.Count(x => x.Opened) > 0; } Console.WriteLine($"和了牌: {new TileIds(new List<TileId> { winTile }).ToOneLineString()}"); foreach (var yakuItem in result.Yaku) { var han = IsOpened ? yakuItem.HanOpen : yakuItem.HanClosed; Console.WriteLine($"{yakuItem.Japanese}\t{han}翻"); } Console.WriteLine($"{result.Han}翻 {result.Fu}符"); Console.WriteLine($"{result.Cost.Main}点"); foreach (var fuItem in result.FuDetailSet) { Console.WriteLine($"符: {fuItem.Fu}\tReason: {fuItem.Reason}"); } Console.WriteLine(""); }
public void Tiles136ToOneLineStringWithAkaDoraTest() { var tiles = new TileIds(new List <int> { 1, 16, 13, 46, 5, 13, 24, 34, 134, 124 }); var expected = "1244579m3p57z"; var actual = tiles.ToOneLineString(printAkaDora: false); AreEqual(expected, actual); expected = "1244079m3p57z"; actual = tiles.ToOneLineString(printAkaDora: true); AreEqual(expected, actual); }
public void Tiles136ToOneLineStringTest() { var tiles = new TileIds(new List <int> { 0, 1, 34, 35, 36, 37, 70, 71, 72, 73, 106, 107, 108, 109, 133, 134 }); var expected = "1199m1199p1199s1177z"; var actual = tiles.ToOneLineString(); AreEqual(expected, actual); }
public ViewModel() { appService_ = new PlayerApplicationService("yamada"); appService_.RequestJoin(); appService_.JoinEvent += (_, e) => { System.Console.WriteLine($"id: {e.JoinRes.Id}"); appService_.RequestHand(); }; appService_.HandEvent += (_, e) => { Hand = e.HandRes.Hand; System.Console.WriteLine($"hand: {Hand.ToOneLineString()}"); appService_.RequestTsumo(); }; appService_.TsumoEvent += (_, e) => { var tsumo = e.TsumoRes.Tsumo; System.Console.WriteLine($"tsumo: {tsumo.ToOneLineString()}"); Hand.Add(tsumo); System.Console.WriteLine($"shanten: {Shanten.CalculateShanten(Hand)}"); var result = HandCalculator.EstimateHandValue(Hand, tsumo, config: new HandConfig(isTsumo: true)); if (result.Error is null) { appService_.RequestAgari(); return; } var index = DecideDahai(); Hand.RemoveAt(index); appService_.RequestDahai(index); }; appService_.DahaiEvent += (_, e) => appService_.RequestTsumo(); appService_.AgariEvent += (_, e) => { var res = e.AgariRes; PrintHandResult(res.Tiles, res.WinTile, res.Melds, res.Result); }; }
private static void PrintTiles(TileIds tiles) { Console.WriteLine(tiles.ToOneLineString()); }