When writing an ai agent, it'd be useful to have a utility function that forecasts a move without changing the state of the current game. Should be able to pass a board state and receive a new board state.
Here is a sample function written in C#:
public Board ForecastMove(Board board, IPly ply)
{
var newBoard = new Board(board);
if (newBoard.ApplyMove(ply))
return newBoard;
throw new InvalidMoveException();
}
When writing an ai agent, it'd be useful to have a utility function that forecasts a move without changing the state of the current game. Should be able to pass a board state and receive a new board state.
Here is a sample function written in C#:
public Board ForecastMove(Board board, IPly ply)
{
var newBoard = new Board(board);
if (newBoard.ApplyMove(ply))
return newBoard;