def test_discard_tile(self): table = Table() player = Player(0, 0, table) tiles = self._string_to_136_array(sou='111345677', pin='15', man='56') tile = self._string_to_136_array(man='9')[0] player.init_hand(tiles) player.draw_tile(tile) discarded_tile = player.discard_tile() self.assertEqual(discarded_tile, 36) player.draw_tile(self._string_to_136_array(pin='4')[0]) discarded_tile = player.discard_tile() self.assertEqual(discarded_tile, 92) player.draw_tile(self._string_to_136_array(pin='3')[0]) discarded_tile = player.discard_tile() self.assertEqual(discarded_tile, 32) player.draw_tile(self._string_to_136_array(man='4')[0]) discarded_tile = player.discard_tile() self.assertEqual(discarded_tile, Shanten.AGARI_STATE)
def test_discard_isolated_honor_tiles_first(self): table = Table() player = Player(0, 0, table) tiles = self._string_to_136_array(sou='8', pin='56688', man='11323', honors='36') tile = self._string_to_136_array(man='9')[0] player.init_hand(tiles) player.draw_tile(tile) discarded_tile = player.discard_tile() self.assertEqual(discarded_tile, 128) player.draw_tile(self._string_to_136_array(man='4')[0]) discarded_tile = player.discard_tile() self.assertEqual(discarded_tile, 116)
def test_set_is_tempai_flag_to_the_player(self): table = Table() player = Player(0, 0, table) tiles = self._string_to_136_array(sou='111345677', pin='45', man='56') tile = self._string_to_136_array(man='9')[0] player.init_hand(tiles) player.draw_tile(tile) player.discard_tile() self.assertEqual(player.in_tempai, False) tiles = self._string_to_136_array(sou='11145677', pin='345', man='56') tile = self._string_to_136_array(man='9')[0] player.init_hand(tiles) player.draw_tile(tile) player.discard_tile() self.assertEqual(player.in_tempai, True)