Game of Ur 0.3.3
This is a computer adaptation of Game of Ur, written in C++ mainly using SDL and OpenGL.
Loading...
Searching...
No Matches
PlayerCPURandom Class Reference

An aspect representing a computer controlled player of the game of ur, which makes its decisions completely randomly. More...

#include <ur_player_cpu_random.hpp>

Inheritance diagram for PlayerCPURandom:

Public Member Functions

std::shared_ptr< BaseSimObjectAspect > clone () const override
 

Static Public Member Functions

static std::string getSimObjectAspectTypeName ()
 
static std::shared_ptr< BaseSimObjectAspect > create (const nlohmann::json &jsonAspectProperties)
 

Private Member Functions

void onActivated () override
 Broadcasts its existence to UrController and receives in exchange an instance of UrPlayerControls.
 
void onMovePrompted (GamePhaseData phaseData)
 Callback for an event from GameOfUrController, prompting this player for a new game-related action.
 

Private Attributes

std::string mControllerPath {}
 The path to the game controller this player interfaces with.
 
std::unique_ptr< UrPlayerControlsmControls {}
 The controls object created by the game controller.
 
std::random_device mRandomDevice {}
 The device responsible for providing this class with random numbers.
 
std::default_random_engine mRandomEngine { mRandomDevice() }
 An engine using the random device.
 
ToyMaker::SignalObserver< GamePhaseDatamObserveMovePrompted { *this, "MovePromptedObserved", [this](GamePhaseData phaseData) { this->onMovePrompted(phaseData); }}
 The observer connected with this aspect, responsible for receiving and responding to move prompt events.
 

Detailed Description

An aspect representing a computer controlled player of the game of ur, which makes its decisions completely randomly.

Member Function Documentation

◆ onMovePrompted()

void PlayerCPURandom::onMovePrompted ( GamePhaseData phaseData)
private

Callback for an event from GameOfUrController, prompting this player for a new game-related action.

Parameters
phaseData

Member Data Documentation

◆ mControls

std::unique_ptr<UrPlayerControls> PlayerCPURandom::mControls {}
private

The controls object created by the game controller.

Provides the interface through which this player is able to interact with the (data model representation of the) game.


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