Exemplo n.º 1
0
 def test_check_doras(self):
     machi_tiles = check_tenpai(self.player.hand, self.player.kabe)
     yaku_calc = YakuCalculator(
         self.player, self.stack, self.bakaze, False,
         machi_tiles, self.player.agari_tile)
     dora = yaku_calc.check_doras()
     self.assertEqual(dora, 1)
Exemplo n.º 2
0
 def test_menzen_tsumo(self):
     machi_tiles = check_tenpai(self.player.hand, self.player.kabe)
     yaku_calc = YakuCalculator(
         self.player, self.stack, self.bakaze, False,
         machi_tiles, self.player.agari_tile)
     total_han, fu = yaku_calc.calculate()
     self.assertEqual(total_han, 2)  # menzen tsumo and dora
     self.assertEqual(fu, 40)
Exemplo n.º 3
0
    def test_no_riichi_kabe(self):
        self.player.hand[Tile(Suit.PINZU.value, 1).index] -= 1
        self.player.hand[Tile(Suit.SOUZU.value, 5).index] -= 2
        naki_tile = Tile(Suit.SOUZU.value, 5)
        naki_tile.owner = 0
        self.player.kabe.append(
            Huro(Naki.PON, naki_tile,
                 [Tile(Suit.SOUZU.value, 5) for i in range(3)]))
        self.player.menzenchin = False

        machi = check_tenpai(self.player.hand, self.player.kabe)
        riichi = check_riichi(self.player, machi, self.stack)
        self.assertEqual(riichi, False)
Exemplo n.º 4
0
 def test_filter_yaku(self):
     machi_tiles = check_tenpai(self.player.hand, self.player.kabe)
     yaku_calc = YakuCalculator(
         self.player, self.stack, self.bakaze, False,
         machi_tiles, self.player.agari_tile)
     possible_yakus = [
         ('ryanpeikou', 3),
         ('chiitoitsu', 2),
         ('menzen_tsumo', 1),
     ]
     final_yakus = yaku_calc.filter_yaku(possible_yakus)
     self.assertEqual(len(final_yakus), 2)
     final_yaku_answer = [
         ('ryanpeikou', 3),
         ('menzen_tsumo', 1),
     ]
     self.assertEqual(final_yakus, final_yaku_answer)
Exemplo n.º 5
0
 def test_riichi_stack(self):
     for i in range(120):
         _ = self.stack.draw()
     machi = check_tenpai(self.player.hand, self.player.kabe)
     riichi = check_riichi(self.player, machi, self.stack)
     self.assertEqual(riichi, False)
Exemplo n.º 6
0
 def test_riichi(self):
     machi = check_tenpai(self.player.hand, self.player.kabe)
     riichi = check_riichi(self.player, machi, self.stack)
     self.assertEqual(riichi, True)
Exemplo n.º 7
0
 def test_no_tenpai(self):
     self.player.hand[Tile(Suit.PINZU.value, 1).index] -= 1
     self.player.hand[Tile(Suit.PINZU.value, 2).index] += 1
     self.assertEqual(check_tenpai(self.player.hand, self.player.kabe), [])
Exemplo n.º 8
0
 def assert_tenpai(self, player, tenpai):
     machi_list = sorted(check_tenpai(player.hand, player.kabe))
     self.assertEqual(machi_list, tenpai)