'points' AI now knows of en passant and how to do it correctly

This commit is contained in:
jake 2023-03-01 13:56:52 -05:00
parent fb3f5d1394
commit 60d509bcbf

13
Main.gd
View file

@ -34,7 +34,7 @@ var team2 = 2
func _ready():
make_player1("green")
#make_player2("red")
make_player2("red")
#checkmatet1()
#checkmatet2()
@ -47,6 +47,10 @@ func _ready():
#spawn_piece("queen", "red", 3, 5, team2)
#spawn_piece("pawn", "red", 7, 1, team2)
#spawn_piece("pawn", "red", 4,4, team2)
#spawn_piece("rook", "red", 1,5, team2)
#spawn_piece("pawn", "blue", 3,6,team1)
var captures = update_capture_tables(board_to_text_board(board))
team1_capture = captures[0]
team2_capture = captures[1]
@ -154,6 +158,13 @@ func evaluate_move(piece, move, text_board, team, depth, add_points=false):
var points = p_board[move[0]][move[1]]
if depth == 0 or depth <= 0:
return points
if points is Array:
# en passant does array ^
# make sure piece is a pawn otherwise no points for moving behind the pawn
if piece_names.pawn == text_board[piece[0]][piece[1]][chess_enum.piece_enum]:
points = points[0]
else:
points = 0
# evaluate opposing team now
var eval_board