Example #1
0
import utilities
import rotation

from classes.piece    import Piece
from classes.point    import Point
from classes.position import Position

from constants import BOARD_SIZE
from constants import INSERTION_POINT


PIECE_00     = Piece('00',          '00.txt', BOARD_SIZE)
PIECE_06     = Piece('06',          '06.txt', BOARD_SIZE)
PIECE_06_INV = Piece('06 inverted', '06.txt', BOARD_SIZE, True)
PIECE_07     = Piece('07',          '07.txt', BOARD_SIZE)
PIECE_07_INV = Piece('07 inverted', '07.txt', BOARD_SIZE, True)
PIECE_08     = Piece('08',          '08.txt', BOARD_SIZE)
PIECE_08_INV = Piece('08 inverted', '08.txt', BOARD_SIZE, True)
PIECE_09     = Piece('09',          '09.txt', BOARD_SIZE)
PIECE_09_INV = Piece('09 inverted', '09.txt', BOARD_SIZE, True)
PIECE_10     = Piece('10',          '10.txt', BOARD_SIZE)
PIECE_10_INV = Piece('10 inverted', '10.txt', BOARD_SIZE, True)

# add references to their inversions
PIECE_06    .inversion = PIECE_06_INV
PIECE_06_INV.inversion = PIECE_06
PIECE_07    .inversion = PIECE_07_INV
PIECE_07_INV.inversion = PIECE_07
PIECE_08    .inversion = PIECE_08_INV
PIECE_08_INV.inversion = PIECE_08
PIECE_09    .inversion = PIECE_09_INV
Example #2
0
 def __init__(self, color, xPos, yPos):
     Piece.__init__(self, color, xPos, yPos)
     self.piecetype = 'knight'
Example #3
0
 def __init__(self, color, xPos, yPos):
     Piece.__init__(self, color, xPos, yPos)
     self.moved = False
     self.piecetype = 'rook'
Example #4
0
 def __init__(self, color, xPos, yPos):
     Piece.__init__(self, color, xPos, yPos)
     self.piecetype = 'pawn'
     self.moved = False
     self.bigMove = -10
Example #5
0
    # Prints the board
    print("\n\n".join(
        ["\t".join([str(cell) for cell in row]) for row in board]))

    # Asks for coordinates and prints the contents of the selected box
    col_s, row_s = input("Input coordinates (x y): ").split()
    col = int(col_s)
    row = int(row_s)

    print("Selected piece: {}".format(board[row][col]))
    if board[row][col] == " ":
        print("Empty box, please try again")

    # Checks movement of pawns
    elif board[row][col] == "Pv" or board[row][col] == "P^":
        pawn = Piece()
        pawn.pawn_move(row, col, board)

    # Checks movement of lancers
    elif board[row][col] == "Lv" or board[row][col] == "L^":
        lance = Piece()
        lance.lance_move(row, col, board)

    # Checks movement of knights
    elif board[row][col] == "Nv" or board[row][col] == "N^":
        knight = Piece()
        knight.knight_move(row, col, board)

    # Checks movement of rooks
    elif board[row][col] == "Rv" or board[row][col] == "R^":
        rook = Piece()
Example #6
0
 def __init__(self, color, xPos, yPos):
     Piece.__init__(self, color, xPos, yPos)
     self.colors = color
     self.piecetype = 'queen'
Example #7
0
 def __init__(self, color, xPos, yPos):
     Piece.__init__(self, color, xPos, yPos)
     self.piecetype = 'bishop'