BCESolve
BCEGameHandler Class Reference

This class handles the widgets for editing/displaying the game. More...

#include <bcegamehandler.hpp>

Inheritance diagram for BCEGameHandler:
Collaboration diagram for BCEGameHandler:

Signals

void startSolveRoutine ()
 Signals that the user has clicked the solve button. More...
 
void cancelSolveRoutine ()
 Signals that the user has clicked the cancel solve button.
 

Public Member Functions

 BCEGameHandler (QWidget *parent)
 Constructor. More...
 
 ~BCEGameHandler ()
 Destructor. More...
 
void setGame (const BCEGame &_game)
 Replaces the current game with _game. More...
 
const BCEGamegetGame () const
 Returns constant reference to the current game.
 
QVBoxLayout * getLayout () const
 Returns the layout.
 
QPushButton * getSolveButton () const
 Returns the solveButton.
 
QPushButton * getCancelButton () const
 Returns the cancelButton.
 
void setState (int state)
 Changes the current state. More...
 
const vector< double > getWeightsOnObjectives ()
 Returns weights on objectives.
 
const vector< vector< double > > getMapBWeights ()
 Returns weights on map boundary objectives. More...
 
const bool getMapBoundaryOption () const
 Returns mapBoundaryOption.
 
const double getMinAngleIncr () const
 

Private Slots

void currentStateChanged (int newS)
 Slot for changing the state. Calls setState.
 
void stateAdded ()
 Adds a new state. Calls changeNumberOfStates.
 
void actionAdded (int player)
 Adds a new action for the indicated player.
 
void typeAdded (int player)
 Adds a new type for the indicated player.
 
void typeRemoved (int player)
 Removes a type for the indicated player.
 
void objectiveAdded ()
 Adds an objective to the game.
 
void objectiveRemoved ()
 Removes an objective from the game.
 
void stateRemoved ()
 Removes the current state.
 
void actionRemoved (int player)
 Removes action for the given player. More...
 
void nextState ()
 Advances currentState to the next state.
 
void prevState ()
 Decreases currentState to the previous state.
 
void emitSolveSignal ()
 Emits the startSolveRoutine signal to BCEWindow.
 
void clearCurrentGame ()
 Clears the game currently displayed in the game tab. More...
 
void setMBSolveOption ()
 Solves the game and maps the boundary.
 
void setMinAngleIncr (QString strValue)
 Sets the minimum angle increment to the provided value.
 

Private Member Functions

void initializeModels ()
 Delete old data models and create new ones. More...
 
void changeNumberOfStates (int newS)
 Adds/removes models to achieve correct number of states.
 
void setupLayout ()
 Sets up the layout for the game handler.
 

Private Attributes

BCEGame game
 The game object. More...
 
BCEPayoffTableModelpayoffModel
 The model for interfacing with payoffs.
 
BCEPriorTableModelpriorModel
 Model for interfacing with prior.
 
BCEConditionalTableModelconditionalModel
 Model for interfacing with conditional distribution of types.
 
BCEObjWeightsTableModelweightsModel
 Model for setting weights on main solver objectives.
 
BCEObjWeightsTableModelobj0WeightsModel
 Model for setting weights on objective0 for mapboundary.
 
BCEObjWeightsTableModelobj1WeightsModel
 Model for settings weights on objective1 for mapboundary.
 
bool mapBoundaryOption
 Map Boundary option. More...
 
double minAngleIncrement
 Minimum Angle increment, used for mapBoundary() More...
 
QVBoxLayout * layout
 Layout for the game tab.
 
QPushButton * solveButton
 Button that triggers solve routine.
 
QPushButton * cancelButton
 Button that cancels solve.
 
QPushButton * clearButton
 Button that clears currently displayed game.
 
QPushButton * mapBoundaryButton
 Button handling map boundary solve option.
 
vector< QLineEdit * > numActionsEdits
 Edits for number of actions.
 
QLineEdit * numStatesEdit
 Edit for number of states.
 
vector< QLineEdit * > numTypesEdits
 Edit for number of types.
 
QLineEdit * numObjectivesEdit
 Edit for number of objectives.
 
QComboBox * currentStateCombo
 Drop down menu for selecting a state.
 
BCETableViewpayoffTableView
 Table for displaying stage payoffs.
 
BCETableViewpriorTableView
 Table for displaying prior.
 
BCETableViewconditionalTableView
 Table for displaying conditional distn of types.
 
BCETableViewweightsTableView
 Table for displaying main solver weights data.
 
BCETableViewobj0WeightsTableView
 Table for displaying mapBoundary objective0 weights data.
 
BCETableViewobj1WeightsTableView
 Table for displaying mapBoundary objective1 weights data.
 

Friends

class BCEPlotHandler
 

Detailed Description

This class handles the widgets for editing/displaying the game.

All of the widgets in the game tab and their slots are members of this class. It also contains the BCEGame and handles the interfaces to the game objects.

The class contains table models for editing the game, which interface with the respective data using the BCEGame class's interface methods.

The class also contains a table model for editing weights on several objectives. This data interfaces with BCESolverWorker, the class for solving custom games the user creates in the game tab.

Constructor & Destructor Documentation

◆ BCEGameHandler()

BCEGameHandler::BCEGameHandler ( QWidget *  parent)

Constructor.

Constructs edits and buttons, connects signals/slots, calls BCEGameHandler::initializeModels.

◆ ~BCEGameHandler()

BCEGameHandler::~BCEGameHandler ( )

Destructor.

Destroys table views, models, etc.

Member Function Documentation

◆ actionRemoved

void BCEGameHandler::actionRemoved ( int  player)
privateslot

Removes action for the given player.

Will remove the action that is currently selected in the payoff table, if one is selected. Otherwise, this function removes the last action for the player.

◆ clearCurrentGame

void BCEGameHandler::clearCurrentGame ( )
privateslot

Clears the game currently displayed in the game tab.

Replaces the cleared game with a new game.

◆ getMapBWeights()

const vector< vector< double > > BCEGameHandler::getMapBWeights ( )

Returns weights on map boundary objectives.

This is a matrix of doubles. The first row gives the weights on objective0 for the mapBoundary algorithm. The second row gives the weights on objective1 for the algorithm.

◆ initializeModels()

void BCEGameHandler::initializeModels ( )
private

Delete old data models and create new ones.

Called in constructor and whenever game changes.

◆ setGame()

void BCEGameHandler::setGame ( const BCEGame _game)

Replaces the current game with _game.

Calls initializeModels to reinitialize references for table models.

◆ setState()

void BCEGameHandler::setState ( int  state)

Changes the current state.

Switches all of the models over to new state and updates table views.

◆ startSolveRoutine

void BCEGameHandler::startSolveRoutine ( )
signal

Signals that the user has clicked the solve button.

Contains map boundary option

Member Data Documentation

◆ game

BCEGame BCEGameHandler::game
private

The game object.

This is the game that is represented in the game tab. Note that this can be a different game than the one that is associated with the solution in the solution tab. Alterations to the game can be saved using options in the file menu.

◆ mapBoundaryOption

bool BCEGameHandler::mapBoundaryOption
private

Map Boundary option.

Tells the solver worker whether or not to map the boundary.

◆ minAngleIncrement

double BCEGameHandler::minAngleIncrement
private

Minimum Angle increment, used for mapBoundary()

Tells the solver what minimum angle increment to use when mapping the boundary.


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