From 60d509bcbf92e3f8fcf28e9d8810e93afba60daa Mon Sep 17 00:00:00 2001 From: jake Date: Wed, 1 Mar 2023 13:56:52 -0500 Subject: [PATCH] 'points' AI now knows of en passant and how to do it correctly --- Main.gd | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Main.gd b/Main.gd index 5b4bd89..9a508b5 100644 --- a/Main.gd +++ b/Main.gd @@ -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