# Path: chess_py/pieces/piece.py
# class Piece:
#     __metaclass__ = ABCMeta
# 
#     @abstractmethod
#     def __init__(self, input_color, location):
#         """
#         Initializes a piece that is capable of moving
# 
#         :type: input_color: Color
#         :type: location: Location
#         :type: white_symbol: str
#         :type: black_symbol: str
#         """
#         assert isinstance(input_color, Color)
#         assert isinstance(location, Location)
# 
#         self.color = input_color
#         self.location = location
# 
#         self.cross_fn = [lambda x: x.shift_up(), lambda x: x.shift_right(),
#                          lambda x: x.shift_down(), lambda x: x.shift_left()]
# 
#         self.diag_fn = [lambda x: x.shift_up_right(), lambda x: x.shift_up_left(),
#                         lambda x: x.shift_down_right(), lambda x: x.shift_down_left()]
# 
#     def __key(self):
#         return self.color, self.location
# 
#     def __hash__(self):
#         return hash(str(self))
# 
#     def __eq__(self, other):
#         """
#         Finds out if piece is the same type and color as self
#         :type: other: Piece
#         """
#         return type(other) is type(self) and other.color == self.color
# 
#     def __ne__(self, other):
#         return not self.__eq__(other)
# 
#     def __repr__(self):
#         return "{}({}, {})".format(self.__class__, self.color, self.location)
# 
#     @abstractmethod
#     def __str__(self):
#         pass
# 
#     @abstractmethod
#     def _symbols(self):
#         pass
# 
#     @abstractmethod
#     def possible_moves(self, position):
#         pass
# 
#     def __copy__(self):
#         return self.__class__(self.color, self.location)
# 
#     @property
#     def symbol(self):
#         return self._symbols()[self.color]
# 
#     def contains_opposite_color_piece(self, square, position):
#         """
#         Finds if square on the board is occupied by a ``Piece``
#         belonging to the opponent.
# 
#         :type: square: Location
#         :type: position: Board
#         :rtype: bool
#         """
#         return not position.is_square_empty(square) and \
#             position.piece_at_square(square).color != self.color
# 
#     def create_move(self, end_loc, status):
#         # TODO: fix circular imports
#         from chess_py import Move
#         return Move(end_loc=end_loc,
#                     piece=self,
#                     status=status,
#                     start_loc=self.location)
# 
# Path: chess_py/pieces/rook.py
# class Rook(Piece):
#     def __init__(self, input_color, location):
#         """
#         Initializes a rook that is capable of being compared to another rook,
#         and returning a list of possible moves.
# 
#         :type: input_color: Color
#         :type: location: Location
#         """
#         super(Rook, self).__init__(input_color, location)
#         self.has_moved = False
# 
#     def _symbols(self):
#         return {color.white: "♜", color.black: "♖"}
# 
#     def __str__(self):
#         return "R"
# 
#     def moves_in_direction(self, direction, position):
#         """
#         Finds moves in a given direction
# 
#         :type: direction: lambda
#         :type: position: Board
#         :rtype: list
#         """
#         current_square = self.location
# 
#         while True:
#             try:
#                 current_square = direction(current_square)
#             except IndexError:
#                 return
# 
#             if self.contains_opposite_color_piece(current_square, position):
#                 yield self.create_move(current_square, notation_const.CAPTURE)
# 
#             if not position.is_square_empty(current_square):
#                 return
# 
#             yield self.create_move(current_square, notation_const.MOVEMENT)
# 
#     def possible_moves(self, position):
#         """
#         Returns all possible rook moves.
# 
#         :type: position: Board
#         :rtype: list
#         """
#         for move in itertools.chain(*[self.moves_in_direction(fn, position) for fn in self.cross_fn]):
#             yield move
# 
# Path: chess_py/core/color.py
# class Color:
#     def __init__(self, raw):
#     def from_string(cls, string):
#     def __repr__(self):
#     def __str__(self):
#     def __bool__(self):
#     def __int__(self):
#     def __key(self):
#     def __hash__(self):
#     def __neg__(self):
#     def __eq__(self, other):
#     def __ne__(self, other):


import itertools
from .piece import Piece
from .rook import Rook
from ..core import color
"""
Class stores Bishop on the board

| rank
| 7 8 ║♜ ♞ ♝ ♛ ♚ ♝ ♞ ♜
| 6 7 ║♟ ♟ ♟ ♟ ♟ ♟ ♟ ♟
| 5 6 ║… … … … … … … …
| 4 5 ║… … … … … … … …
| 3 4 ║… … … … … … … …
| 2 3 ║… … … … … … … …
| 1 2 ║♙ ♙ ♙ ♙ ♙ ♙ ♙ ♙
| 0 1 ║♖ ♘ ♗ ♕ ♔ ♗ ♘ ♖
| ----╚═══════════════
| ——---a b c d e f g h
| -----0 1 2 3 4 5 6 7
| ------file

| Copyright © 2016 Aubhro Sengupta. All rights reserved.
"""




class Bishop(Rook, Piece):
    def __init__(self, input_color, location):
        """
        Creates Bishop object that can be compared to and return possible moves

        :type: input_color: Color
        """

# Path: chess_py/pieces/piece.py
# class Piece:
#     __metaclass__ = ABCMeta
# 
#     @abstractmethod
#     def __init__(self, input_color, location):
#         """
#         Initializes a piece that is capable of moving
# 
#         :type: input_color: Color
#         :type: location: Location
#         :type: white_symbol: str
#         :type: black_symbol: str
#         """
#         assert isinstance(input_color, Color)
#         assert isinstance(location, Location)
# 
#         self.color = input_color
#         self.location = location
# 
#         self.cross_fn = [lambda x: x.shift_up(), lambda x: x.shift_right(),
#                          lambda x: x.shift_down(), lambda x: x.shift_left()]
# 
#         self.diag_fn = [lambda x: x.shift_up_right(), lambda x: x.shift_up_left(),
#                         lambda x: x.shift_down_right(), lambda x: x.shift_down_left()]
# 
#     def __key(self):
#         return self.color, self.location
# 
#     def __hash__(self):
#         return hash(str(self))
# 
#     def __eq__(self, other):
#         """
#         Finds out if piece is the same type and color as self
#         :type: other: Piece
#         """
#         return type(other) is type(self) and other.color == self.color
# 
#     def __ne__(self, other):
#         return not self.__eq__(other)
# 
#     def __repr__(self):
#         return "{}({}, {})".format(self.__class__, self.color, self.location)
# 
#     @abstractmethod
#     def __str__(self):
#         pass
# 
#     @abstractmethod
#     def _symbols(self):
#         pass
# 
#     @abstractmethod
#     def possible_moves(self, position):
#         pass
# 
#     def __copy__(self):
#         return self.__class__(self.color, self.location)
# 
#     @property
#     def symbol(self):
#         return self._symbols()[self.color]
# 
#     def contains_opposite_color_piece(self, square, position):
#         """
#         Finds if square on the board is occupied by a ``Piece``
#         belonging to the opponent.
# 
#         :type: square: Location
#         :type: position: Board
#         :rtype: bool
#         """
#         return not position.is_square_empty(square) and \
#             position.piece_at_square(square).color != self.color
# 
#     def create_move(self, end_loc, status):
#         # TODO: fix circular imports
#         from chess_py import Move
#         return Move(end_loc=end_loc,
#                     piece=self,
#                     status=status,
#                     start_loc=self.location)
# 
# Path: chess_py/pieces/rook.py
# class Rook(Piece):
#     def __init__(self, input_color, location):
#         """
#         Initializes a rook that is capable of being compared to another rook,
#         and returning a list of possible moves.
# 
#         :type: input_color: Color
#         :type: location: Location
#         """
#         super(Rook, self).__init__(input_color, location)
#         self.has_moved = False
# 
#     def _symbols(self):
#         return {color.white: "♜", color.black: "♖"}
# 
#     def __str__(self):
#         return "R"
# 
#     def moves_in_direction(self, direction, position):
#         """
#         Finds moves in a given direction
# 
#         :type: direction: lambda
#         :type: position: Board
#         :rtype: list
#         """
#         current_square = self.location
# 
#         while True:
#             try:
#                 current_square = direction(current_square)
#             except IndexError:
#                 return
# 
#             if self.contains_opposite_color_piece(current_square, position):
#                 yield self.create_move(current_square, notation_const.CAPTURE)
# 
#             if not position.is_square_empty(current_square):
#                 return
# 
#             yield self.create_move(current_square, notation_const.MOVEMENT)
# 
#     def possible_moves(self, position):
#         """
#         Returns all possible rook moves.
# 
#         :type: position: Board
#         :rtype: list
#         """
#         for move in itertools.chain(*[self.moves_in_direction(fn, position) for fn in self.cross_fn]):
#             yield move
# 
# Path: chess_py/core/color.py
# class Color:
#     def __init__(self, raw):
#     def from_string(cls, string):
#     def __repr__(self):
#     def __str__(self):
#     def __bool__(self):
#     def __int__(self):
#     def __key(self):
#     def __hash__(self):
#     def __neg__(self):
#     def __eq__(self, other):
#     def __ne__(self, other):


# Path: chess_py/pieces/bishop.py
import itertools
from .piece import Piece
from .rook import Rook
from ..core import color

"""
Class stores Bishop on the board

| rank
| 7 8 ║♜ ♞ ♝ ♛ ♚ ♝ ♞ ♜
| 6 7 ║♟ ♟ ♟ ♟ ♟ ♟ ♟ ♟
| 5 6 ║… … … … … … … …
| 4 5 ║… … … … … … … …
| 3 4 ║… … … … … … … …
| 2 3 ║… … … … … … … …
| 1 2 ║♙ ♙ ♙ ♙ ♙ ♙ ♙ ♙
| 0 1 ║♖ ♘ ♗ ♕ ♔ ♗ ♘ ♖
| ----╚═══════════════
| ——---a b c d e f g h
| -----0 1 2 3 4 5 6 7
| ------file

| Copyright © 2016 Aubhro Sengupta. All rights reserved.
"""




class Bishop(Rook, Piece):
    def __init__(self, input_color, location):
        """
        Creates Bishop object that can be compared to and return possible moves

        :type: input_color: Color
        """

        Piece.__init__(self, input_color, location)