Click or drag to resize
MCTS Class
The MCTS Class contains the implementation for the Monte Carlo Tree Search algorithm. This implementation uses the UCT formula for the selection step after all initial nodes for the CPU player have been generated. This formula is defined in the Node class which holds data about the current Board state.
Inheritance Hierarchy
SystemObject
  VikingChess.ModelMCTS

Namespace: VikingChess.Model
Assembly: VikingChess (in VikingChess.exe) Version: 1.0.0.0 (1.0.0.0)
Syntax
C#
internal class MCTS

The MCTS type exposes the following members.

Constructors
  NameDescription
Public methodMCTS
Initializes a new instance of the MCTS class
Top
Methods
  NameDescription
Public methodEquals (Inherited from Object.)
Private methodevaluateBoard
Scores a Board on the following parameters: Win/Loss, Piece count and Board Control.
Private methodevaluateControl
Finds the outermost pieces on the board and scores the board appropriately. The reason for this is that control of the outer squares in an advantage to both players.
Protected methodFinalize (Inherited from Object.)
Public methodgenerateNodes
Generate all possible move states for the alpha player.
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Public methodmakeMove
Performs the MCTS algorithm.
Protected methodMemberwiseClone (Inherited from Object.)
Public methodPerformSteps
Performs te four steps of the MCTS algorithm: 1. Selection. 2. Expansion. 3. Simulation. 4. Backpropogation
Private methodscorePieces
Count the number of pieces on the board and score the board appropriately
Public methodSimulateGame
Simulates a Game between two Player then scores the resulting Board.
Public methodToString (Inherited from Object.)
Top
Fields
  NameDescription
Private fieldalphaPlayer
The alphaPlayer is the CPU player running the MCTS algorithm and score are generated in favour of this player.
Private fieldStatic memberLOSS_POINTS
The number of points a node receives if the simulation results in a loss for the CPU player.
Private fieldStatic memberPLAYOUTS
The number of times the steps of the MCTS algorithm run before the best node is chosen. Increasing this value may result in a better decision by the CPU at the cost of an increase in the time taken to produce a result and a higher memory cost.
Private fieldroot
The root node of the game tree.
Private fieldStatic memberSIM_TURNCOUNT
The number of moves to process during the simulation step.
Private fieldStatic memberWIN_POINTS
The number of points a node receives if the simulation results in a win for the CPU player.
Top
See Also