diff --git a/chess/chess_64.py b/chess/chess_64.py index 0b1f1bb..db5d797 100644 --- a/chess/chess_64.py +++ b/chess/chess_64.py @@ -1,11 +1,24 @@ -type_to_name = [] +# White Constants +W_KIN, W_QUE, W_BIS, W_NHT, W_ROO, W_PAW = range(6) +# Black Constans +B_KIN, B_QUE, B_BIS, B_NHT, B_ROO, B_PAW = range(6,12) +# Turn Constants +WHITE, BLACK = 0, 1 +# Piece Constants +KIN, QUE, BIS, NHT, ROO, PAW = range(6) +# Square Constants +A8, B8, C8, D8, E8, F8, G8, H8 = range(56, 64) +A7, B7, C7, D7, E7, F7, G7, H7 = range(48, 56) +A6, B6, C6, D6, E6, F6, G6, H6 = range(40, 48) +A5, B5, C5, D5, E5, F5, G5, H5 = range(32, 40) +A4, B4, C4, D4, E4, F4, G4, H4 = range(24, 32) +A3, B3, C3, D3, E3, F3, G3, H3 = range(16, 24) +A2, B2, C2, D2, E2, F2, G2, H2 = range(8, 16) +A1, B1, C1, D1, E1, F1, G1, H1 = range(8) -PIECE_TO_UNICODE = { - "wk": "\u2654 ", "wq": "\u2655 ", "wr": "\u2656 ", "wb": "\u2657 ", "wn": "\u2658 ", "wp": "\u2659 ", - "bk": "\u265A ", "bq": "\u265B ", "br": "\u265C ", "bb": "\u265D ", "bn": "\u265E ", "bp": "\u265F " -} NOT_A_FILE = 0xfefefefefefefefe NOT_H_FILE = 0x7f7f7f7f7f7f7f7f +FULL_MASK = 0xffffffffffffffff INDEX_TO_FIELD = [ "a1", "b1", "c1", "d1", "e1", "f1", "g1", "h1", @@ -31,4 +44,70 @@ INDEX_TO_FIELD = [ ''' +class bitboard(): + def __init__(self) -> None: + + # WHITE 0:King, 1:Queen, 2:Bishop, 3:Knight, 4:Rook, 5:Pawn + # BLACK 6:King, 7:Queen, 8:Bishop, 9:Knight, 10:Rook, 11:Pawn + self.bitboards = [0, 0, 0, 0, 0, 0, # List of All Bitboards + 0, 0, 0, 0, 0, 0] + + self.side_to_move = WHITE + self.bitboards[W_KIN] = 1 << E1 + self.bitboards[W_QUE] = 1 << D1 + self.bitboards[W_BIS] = (1 << C1) | (1 << F1) + self.bitboards[W_NHT] = (1 << B1) | (1 << G1) + self.bitboards[W_ROO] = (1 << A1) | (1 << H1) + self.bitboards[W_PAW] = 0xFF << 8 + + self.bitboards[B_KIN] = 1 << E8 + self.bitboards[B_QUE] = 1 << D8 + self.bitboards[B_BIS] = (1 << C8) | (1 << F8) + self.bitboards[B_NHT] = (1 << B8) | (1 << G8) + self.bitboards[B_ROO] = (1 << A8) | (1 << H8) + self.bitboards[B_PAW] = 0xFF << 48 + + self.all_white = self.bitboards[W_KIN] | self.bitboards[W_QUE] | self.bitboards[W_BIS] | self.bitboards[W_NHT] | self.bitboards[W_ROO] | self.bitboards[W_PAW] + self.all_black = self.bitboards[W_KIN] | self.bitboards[W_QUE] | self.bitboards[W_BIS] | self.bitboards[W_NHT] | self.bitboards[W_ROO] | self.bitboards[W_PAW] + self.all_piece = self.all_white | self.all_black + + self.move_list = [] + + def get_all_moves(self): + turn_offset = self.side_to_move * 6 + + move_list = [] + + # King Moves + king = self.bitboards[KIN] + king_moves = 0 + king_moves |= king + + pass + + + + + def make_move(self, move): + # MOVE: + # Aufbau: + # Bit 0-5: Target (6 Bit, Index: 0-63) + # Bit 6-11: Source (6 Bit, Index: 0-63) + # Bit 12-15: Flags (4 Bit) + # 0000: 0 Quiet 0100: 4 Capture 1000: 8 Promo NHT + # 0001: 1 Double Pawn Push 0101: 5 En Passant 1001: 9 Promo BIS + # 0010: 2 King Castle 0110: 1010: 10 Promo ROO + # 0011: 3 Queen Castle 0111: 1011: 11 Promo QUE + pass + + + +def encode_move(): + pass + +def decode_move(): + pass + + + \ No newline at end of file