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

This thinker plays randomly and hoards memory for testing purposes. More...

+ Inheritance diagram for RandomMemoryHoarderThinker:
+ Collaboration diagram for RandomMemoryHoarderThinker:

Public Member Functions

override void Setup (string str)
 Setup the random memory hoarder. More...
 
override FutureMove Think (Board board, CancellationToken ct)
 Perform a move. More...
 

Public Attributes

ulong[] memory
 Array where to place stuff that will occupy memory. Leave it public so compiler doesn't optimize it out. More...
 

Additional Inherited Members

Detailed Description

This thinker plays randomly and hoards memory for testing purposes.

Member Function Documentation

◆ Setup()

override void Setup ( string  str)
inlinevirtual

Setup the random memory hoarder.

Parameters
strA string representation of the memory size in bytes.
Exceptions
ArgumentExceptionThrown when an invalid parameter is given in str .
See also
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.

Member Data Documentation

◆ memory

ulong [] memory

Array where to place stuff that will occupy memory. Leave it public so compiler doesn't optimize it out.


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