Class AgentExtensions
- Namespace
- WeiqiSharp.Core.Agents
- Assembly
- WeiqiSharp.Core.dll
A variety of extension functions which provide utility for crafting IAgent implementations.
public static class AgentExtensions
- Inheritance
-
AgentExtensions
- Inherited Members
Methods
GetAllLiberties(Board, int, int)
A function which finds all the liberties attached to a specific stone by flood filling the group until it reaches the edges.
public static HashSet<(int column, int row)> GetAllLiberties(this Board board, int col, int row)
Parameters
boardBoardThe board which is to be searched.
colintThe column of the space to be checked.
rowintThe row of the space to be checked.
Returns
- HashSet<(int x, int y)>
A HashSet<T> with each of the locations of the empty spaces surrounding the group.
Remarks
This method may be deprecated in the future, as the GetGroups(Board) method performs this same lookup for all groups on the board.
GetGroups(Board)
Finds all groups of stones on a given board. Does this in single access of each space on board for a constant time lookup.
public static IReadOnlyDictionary<SpaceState, HashSet<Group>> GetGroups(this Board board)
Parameters
boardBoardThe board which is to be searched.
Returns
- IReadOnlyDictionary<SpaceState, HashSet<Group>>
A dictionary which maps each SpaceState to a HashSet<T> of Groups of spaces. Each "internal" hashset corresponds to one contiguous group of stones.
Remarks
Also returns all groups of empty stones, which could be very useful for estimating scoring.