Example #1
0
    def check_pawn_promotion(cls, piece):
        '''Check if pawn is promoting -> exec control: promote(piece) func'''
        # line of promotion
        line = PossibleMove.get_line(inv_c(piece.color))

        if piece.y == line:
            # promote
            cls.controls[piece.color].promote(piece)
Example #2
0
    def check_castle_moves(cls, king):
        line = PossibleMove.get_line(king.color)
        
        can_long, can_short = PossibleMove.get_castle(king.color)

        if can_long:
            rock = cls.players[king.color].get_piece((0, line))
            # execute long castle
            king.move((2,line))
            rock.move((3, line))
            return True
        
        if can_short:
            rock = cls.players[king.color].get_piece((7, line))
            # execute short castle
            king.move((6,line))
            rock.move((5, line))
            return True
Example #3
0
 def handeln_castle_case(self, color, can_long, can_short):
     line = PossibleMove.get_line(color)
     
     if can_long:
         case = Board.get_case((2,line))
         case.possible_move = True