Table of Contents

Interface IAgent

Namespace
WeiqiSharp.Core
Assembly
WeiqiSharp.Core.dll

Represents a "player" in a go game.

public interface IAgent

Properties

Color

SpaceState Color { get; init; }

Property Value

SpaceState

Methods

GetMove(Board)

Asks the agent to perform a move. An arbitrary amount of extra work can be done to implement this.

Move GetMove(Board board)

Parameters

board Board

The current state of the board.

Returns

Move

The Move to be played on the board given.

Remarks

Note that the board itself can prevent the agent from making simple mistakes (suicide, e.g.). However, ko is not represented in the current state of the board, it is stored in, effectively, metadata that cannot easily be made available to the agent. As such, if the agent tries to make an illegal move, the GetMove(Board, IReadOnlyList<Move>) method will be called next, containing the illegal moves tried on this turn.

GetMove(Board, IReadOnlyList<Move>)

Asks the agent to perform a move. An arbitrary amount of extra work can be done to implement this.

Move GetMove(Board board, IReadOnlyList<Move> invalidMoves)

Parameters

board Board

The current state of the board.

invalidMoves IReadOnlyList<Move>

A list of previously-tried invalid moves.

Returns

Move

The Move to be played on the board given.

Remarks

This overload should be used to inform the agent of invalid moves it has already taken. A prospective agent then doesn't need to keep track of the state of the board over time; it could just store the previous state it saw and build a hierarchical list of moves that would work for that state, then clear that when that board state is no longer necessary (when they get one that doesn't match it).

Note that the board itself can prevent the agent from making simple mistakes (suicide, e.g.). However, ko is not represented in the current state of the board, it is stored in, effectively, metadata that cannot easily be made available to the agent.