1
0
mirror of https://github.com/tiyn/yeschess.git synced 2025-10-20 14:51:21 +02:00

refactoring: cleanup engine code and add alpha beta to readme

This commit is contained in:
TiynGER
2021-05-03 17:09:48 +02:00
parent b7480a0cd4
commit 3c97395ce8
4 changed files with 54 additions and 81 deletions

View File

@@ -667,8 +667,8 @@ proc genLegalKingMoves(chess: Chess, field: int, color: Color): seq[Move] =
proc genLegalMoves(chess: Chess, field: int, color: Color): seq[Move] =
## Generates all legal moves in a `chess` starting from `field` for a `color`.
var legal_moves = newSeq[Move]()
var target = ord(color) * chess.board[field]
if 0 < target and target < WEnPassant:
var target = abs(chess.board[field])
if WPawn <= target and target <= WKing:
legal_moves = case target:
of WPawn:
chess.genLegalPawnMoves(field, color)