-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bb16cc9
commit fc52e7d
Showing
1 changed file
with
107 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,103 +1,108 @@ | ||
class Bitboard{ | ||
... | ||
}; | ||
|
||
class ChessBoard{ | ||
Chessboard(bitborad Pawns, ...) | ||
Chessboard(Chessboard currentChessBoard, Move MoveApplied) //return kainouria Chessboard dedomenis mias kinisis, dld ton startIndex kai endIndex | ||
//kai if an ginei capture | ||
|
||
movePawns{//legal check | ||
array[Moves] resultArray; | ||
|
||
temp[Bitboard] = BitboardPawns.Generate_left_captures(current); //ola ta bitboards pou proekypsan apo pawn moves | ||
|
||
//APOPLEKW | ||
|
||
for bb in temp: | ||
//LEGAL CHECK | ||
resultArray.add( Move(Bitboard) )) // prosthetw sto resultArray to move | ||
// efarmozontas allages sto current Cheesboard | ||
|
||
|
||
|
||
//changes required p.x. occupied | ||
return resultArray;//array apo kainouries moves pou prokiptoun apo pawns | ||
} | ||
moveKnights | ||
|
||
... | ||
|
||
array[Moves] getMoves{ | ||
movePawns + moveKnights + ... | ||
} | ||
getCapture(){return afterCApture} | ||
}; | ||
|
||
class Move{ | ||
public: | ||
Move(); | ||
protected: | ||
int startIndex; | ||
int endIndex; | ||
bool isCapture; | ||
|
||
} | ||
|
||
class Node{ | ||
... | ||
Chessboard c; | ||
moves = c.getMoves(); | ||
for Move in moves: | ||
new Chessboard(c, Move); | ||
node.addChild(); | ||
|
||
bool afterCapture; // | ||
|
||
}; | ||
|
||
class BitboardPawns : Bitboard{ | ||
Bitboard current; | ||
Bitboard Generate_left_captures(current){ | ||
return new Bitboard with pawn position after Left Captures | ||
} | ||
Bitboard Generate_right_captures(current){ | ||
return new Bitboard with pawn position after Right Captures | ||
} | ||
Bitboard Generate_front_moves(current){ | ||
return new Bitboard with pawn position after front moves | ||
} | ||
Bitboard Generate_double_front_moves(current){ | ||
return new Bitboard with pawn position after front moves | ||
} | ||
//ekkremei an passan | ||
array[bitboards] Extract_moves(current, all of the above bitboards) //ginetai apoplexi | ||
return array of possible pawn moves | ||
} | ||
|
||
class Knights{ | ||
Bitboard current; | ||
list[] extract_knights_index(current){ | ||
return list of indexes of knights | ||
} | ||
Bitboard Generate_moves_from_index(index){ | ||
return precalculated moves given an index | ||
} | ||
}; | ||
|
||
Same class for King ?? | ||
|
||
class Bishop{ | ||
Bitboard current | ||
list[] extract_bishop_index(current){ | ||
return list of indexes of knights | ||
} | ||
Bitboard Get_Blockers(current ChessBoard position, index) | ||
return Bitboard with 1 where blocker | ||
|
||
moves Generate_moves_from_index(index){ | ||
return precalculated moves given an index | ||
} | ||
}; | ||
|
||
class Bitboard{ | ||
... | ||
}; | ||
|
||
class ChessBoard{ | ||
Chessboard(bitborad Pawns, ...) | ||
Chessboard(Chessboard currentChessBoard, Move MoveApplied) //return kainouria Chessboard dedomenis mias kinisis, dld ton startIndex kai endIndex | ||
//kai if an ginei capture | ||
|
||
array[Moves] getMoves{ | ||
if (check) { | ||
... | ||
} | ||
bb King_moves_legal(); | ||
//apople3e, orise moves kai append to resultArray | ||
|
||
Bitboard [pins, pinners] = find_pins(); //see xRayAttacks | ||
for pins { | ||
|
||
//only move along the pin direction (easy since we have each pinner) | ||
|
||
} | ||
for !pins { //NOT(XOR(White, pins)) | ||
|
||
BitboardPawns -= pins; | ||
temp[Bitboard] = BitboardPawns.Generate_left_captures(current); | ||
for bb in temp: //apople3e, orise moves kai append to resultArray | ||
resultArray.add( Move(Bitboard, ) )) | ||
//etc | ||
revert this: BitboardPawns -= pins; | ||
|
||
... | ||
|
||
} | ||
|
||
|
||
|
||
|
||
return resultArray; | ||
//WHAT IS "changes required p.x. occupied"? | ||
|
||
} | ||
}; | ||
|
||
class Move { | ||
public: | ||
Move(start,end,isCapture); | ||
protected: | ||
int startIndex; | ||
int endIndex; | ||
bool isCapture; | ||
} | ||
|
||
class Node{ | ||
... | ||
Chessboard c; | ||
moves = c.getMoves(); | ||
for Move in moves: | ||
new Chessboard(c, Move); | ||
node.addChild(); | ||
|
||
bool afterCapture; // | ||
|
||
}; | ||
|
||
class BitboardPawns : Bitboard{ | ||
Bitboard current; | ||
Bitboard Generate_left_captures(current){ | ||
return new Bitboard with pawn position after Left Captures | ||
} | ||
Bitboard Generate_right_captures(current){ | ||
return new Bitboard with pawn position after Right Captures | ||
} | ||
Bitboard Generate_front_moves(current){ | ||
return new Bitboard with pawn position after front moves | ||
} | ||
Bitboard Generate_double_front_moves(current){ | ||
return new Bitboard with pawn position after front moves | ||
} | ||
//ekkremei an passan | ||
} | ||
|
||
class Knights{ | ||
Bitboard current; | ||
list[] extract_knights_index(current){ | ||
return list of indexes of knights | ||
} | ||
Bitboard Generate_moves_from_index(index){ | ||
return precalculated moves given an index | ||
} | ||
}; | ||
|
||
Same class for King ?? | ||
|
||
class Bishop{ | ||
Bitboard current | ||
list[] extract_bishop_index(current){ | ||
return list of indexes of knights | ||
} | ||
Bitboard Get_Blockers(current ChessBoard position, index) | ||
return Bitboard with 1 where blocker | ||
|
||
moves Generate_moves_from_index(index){ | ||
return precalculated moves given an index | ||
} | ||
}; | ||
|
||
Same for Rook, Queen |