From 8b4fe980a4f3228cdd925a537ba02e363a3f5ba9 Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Sat, 22 Jul 2023 12:25:45 -0500 Subject: [PATCH] Add a helper method to print the SAN format of a given move. For debugging purposes, given that MoveUtility isn't in the API namespace. --- Chess-Challenge/src/API/Board.cs | 2 +- Chess-Challenge/src/API/Move.cs | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Chess-Challenge/src/API/Board.cs b/Chess-Challenge/src/API/Board.cs index 2b284d71f..8d164aca0 100644 --- a/Chess-Challenge/src/API/Board.cs +++ b/Chess-Challenge/src/API/Board.cs @@ -7,7 +7,7 @@ namespace ChessChallenge.API public sealed class Board { - readonly Chess.Board board; + readonly internal Chess.Board board; readonly APIMoveGen moveGen; readonly HashSet repetitionHistory; diff --git a/Chess-Challenge/src/API/Move.cs b/Chess-Challenge/src/API/Move.cs index 936d31942..9b758ae42 100644 --- a/Chess-Challenge/src/API/Move.cs +++ b/Chess-Challenge/src/API/Move.cs @@ -59,6 +59,10 @@ public override string ToString() return $"Move: '{moveName}'"; } + public string GetSAN(Board board) { + return MoveUtility.GetMoveNameSAN(this.move, board.board); + } + /// /// Tests if two moves are the same. /// This is true if they move to/from the same square, and move/capture/promote the same piece type