ColorShapeLinks AI
An AI competition for the IEEE Conference on Games 2021
MinimaxAIThinker Class Reference

Sample AI thinker using a basic Minimax algorithm with a naive heuristic which previledges center board positions. More...

+ Inheritance diagram for MinimaxAIThinker:
+ Collaboration diagram for MinimaxAIThinker:

Public Member Functions

override void Setup (string str)
 Setups up this thinker's maximum search depth. More...
 
override string ToString ()
 Returns the name of this AI thinker which will include the maximum search depth. More...
 
override FutureMove Think (Board board, CancellationToken ct)
 Perform a move. More...
 

Static Public Attributes

const int defaultMaxDepth = 3
 The default maximum search depth. More...
 

Additional Inherited Members

Detailed Description

Sample AI thinker using a basic Minimax algorithm with a naive heuristic which previledges center board positions.

This is the same implementation used in the Implementing a simple Minimax player tutorial.

Member Function Documentation

◆ Setup()

override void Setup ( string  str)
inlinevirtual

Setups up this thinker's maximum search depth.

Parameters
strA string which should be convertible to a positive int.

If str is not convertible to a positive int, the maximum search depth is set to defaultMaxDepth.

See also
ColorShapeLinks.Common.AI.AbstractThinker.Setup

Reimplemented from AbstractThinker.

◆ Think()

override FutureMove Think ( Board  board,
CancellationToken  ct 
)
inlinevirtual

Perform a move.

Parameters
boardThe game board.
ctA cancellation token.
Returns
The move to be performed.

The main thread may ask the thinker to stop thinking. As such, this method should frequently test if a cancellation request was made to the cancellation token (ct ). If so, it should return immediately with no move performed, as exemplified in the following code:

if (ct.IsCancellationRequested) return FutureMove.NoMove;
See also
IThinker.Think

Implements AbstractThinker.

◆ ToString()

override string ToString ( )
inline

Returns the name of this AI thinker which will include the maximum search depth.

Returns
The name of this AI thinker.

Member Data Documentation

◆ defaultMaxDepth

const int defaultMaxDepth = 3
static

The default maximum search depth.


The documentation for this class was generated from the following file: