예제 #1
0
파일: knight.py 프로젝트: Zevgon/aa_2
 def valid_moves(self):
     possibles = self.possibles()
     would_be_checker = Piece.blocking_check_against(self)
     if would_be_checker:
         return []
     else:
         return possibles
예제 #2
0
파일: pawn.py 프로젝트: Zevgon/aa_2
    def valid_moves(self):
        would_be_checker = Piece.blocking_check_against(self)
        if would_be_checker:
            if would_be_checker.pos in self.possibles():
                return [would_be_checker.pos]
            else:
                return []
        i, j = self.pos
        forward_one = [self.operator1(i, 1), j]
        forward_two = [self.operator1(i, 2), j]
        forward_left, forward_right = self.taking_positions()

        return self.filter_valids(forward_one, forward_two, forward_left,
                                  forward_right)