@@ -762,30 +762,72 @@ def test_calculate_second_level_ukeire(self):
762762
763763 tile = self ._string_to_136_tile (man = '4' )
764764 discard_option = [x for x in discard_options if x .tile_to_discard == tile // 4 ][0 ]
765- player .ai .hand_builder .calculate_second_level_ukeire (discard_option )
765+ player .ai .hand_builder .calculate_second_level_ukeire (discard_option , player . tiles , player . melds )
766766 self .assertEqual (discard_option .ukeire_second , 108 )
767767
768768 tile = self ._string_to_136_tile (man = '3' )
769769 discard_option = [x for x in discard_options if x .tile_to_discard == tile // 4 ][0 ]
770- player .ai .hand_builder .calculate_second_level_ukeire (discard_option )
770+ player .ai .hand_builder .calculate_second_level_ukeire (discard_option , player . tiles , player . melds )
771771 self .assertEqual (discard_option .ukeire_second , 108 )
772772
773773 tile = self ._string_to_136_tile (pin = '2' )
774774 discard_option = [x for x in discard_options if x .tile_to_discard == tile // 4 ][0 ]
775- player .ai .hand_builder .calculate_second_level_ukeire (discard_option )
775+ player .ai .hand_builder .calculate_second_level_ukeire (discard_option , player . tiles , player . melds )
776776 self .assertEqual (discard_option .ukeire_second , 96 )
777777
778778 tile = self ._string_to_136_tile (pin = '3' )
779779 discard_option = [x for x in discard_options if x .tile_to_discard == tile // 4 ][0 ]
780- player .ai .hand_builder .calculate_second_level_ukeire (discard_option )
780+ player .ai .hand_builder .calculate_second_level_ukeire (discard_option , player . tiles , player . melds )
781781 self .assertEqual (discard_option .ukeire_second , 96 )
782782
783783 tile = self ._string_to_136_tile (pin = '5' )
784784 discard_option = [x for x in discard_options if x .tile_to_discard == tile // 4 ][0 ]
785- player .ai .hand_builder .calculate_second_level_ukeire (discard_option )
785+ player .ai .hand_builder .calculate_second_level_ukeire (discard_option , player . tiles , player . melds )
786786 self .assertEqual (discard_option .ukeire_second , 96 )
787787
788788 tile = self ._string_to_136_tile (pin = '6' )
789789 discard_option = [x for x in discard_options if x .tile_to_discard == tile // 4 ][0 ]
790- player .ai .hand_builder .calculate_second_level_ukeire (discard_option )
790+ player .ai .hand_builder .calculate_second_level_ukeire (discard_option , player . tiles , player . melds )
791791 self .assertEqual (discard_option .ukeire_second , 96 )
792+
793+ def test_choose_1_shanten_with_cost_possibility_draw (self ):
794+ table = Table ()
795+ player = table .player
796+ table .add_dora_indicator (self ._string_to_136_tile (sou = '4' ))
797+
798+ tiles = self ._string_to_136_array (man = '557' , pin = '468' , sou = '55577' , honors = '66' )
799+ player .init_hand (tiles )
800+
801+ meld = self ._make_meld (Meld .PON , sou = '555' )
802+ player .add_called_meld (meld )
803+
804+ tile = self ._string_to_136_tile (sou = '7' )
805+ player .draw_tile (tile )
806+ discarded_tile = player .discard_tile ()
807+ self .assertNotEqual (player .ai .current_strategy , None )
808+ self .assertEqual (player .ai .current_strategy .type , BaseStrategy .YAKUHAI )
809+ self .assertEqual (self ._to_string ([discarded_tile ]), '7m' )
810+
811+ def test_choose_1_shanten_with_cost_possibility_meld (self ):
812+ table = Table ()
813+ player = table .player
814+ table .add_dora_indicator (self ._string_to_136_tile (sou = '4' ))
815+
816+ tiles = self ._string_to_136_array (man = '557' , pin = '468' , sou = '55577' , honors = '66' )
817+ player .init_hand (tiles )
818+
819+ meld = self ._make_meld (Meld .PON , sou = '555' )
820+ player .add_called_meld (meld )
821+
822+ tile = self ._string_to_136_tile (sou = '7' )
823+ meld , discard_option = player .try_to_call_meld (tile , False )
824+ self .assertNotEqual (meld , None )
825+ self .assertEqual (meld .type , Meld .PON )
826+ self .assertEqual (self ._to_string (meld .tiles ), '777s' )
827+
828+ self .assertNotEqual (player .ai .current_strategy , None )
829+ self .assertEqual (player .ai .current_strategy .type , BaseStrategy .YAKUHAI )
830+
831+ discarded_tile = discard_option .find_tile_in_hand (player .closed_hand )
832+
833+ self .assertEqual (self ._to_string ([discarded_tile ]), '7m' )
0 commit comments