| lab_ml
    Lazy Machine Learning | 
Represents a algorithm to learn the game of Nim. More...
#include <NimLearner.h>
| Public Member Functions | |
| NimLearner (unsigned startingTokens) | |
| Constructor to create a game of Nim with startingTokensstarting tokens.  More... | |
| std::vector< Edge > | playRandomGame () const | 
| Plays a random game of Nim, returning the path through the state graph as a vector of Edgeclasses.  More... | |
| void | updateEdgeWeights (const std::vector< Edge > &path) | 
| void | labelEdgesFromThreshold (int threshold) | 
| Label the edges as "WIN" or "LOSE" based on a threshold.  More... | |
| const Graph & | getGraph () const | 
| Returns a constant reference to the state space graph.  More... | |
| Private Attributes | |
| Graph | g_ | 
| Vertex | startingVertex_ | 
Represents a algorithm to learn the game of Nim.
| NimLearner::NimLearner | ( | unsigned | startingTokens | ) | 
Constructor to create a game of Nim with startingTokens starting tokens. 
This function creates a graph, g_ representing all of the states of a game of Nim with vertex labels "p#-X", where:
For example: "p1-4" is Player 1's turn with four (4) tokens remaining "p2-8" is Player 2's turn with eight (8) tokens remaining
All legal moves between states are created as edges with initial weights of 0.
| startingTokens | The number of starting tokens in the game of Nim. | 
| const Graph & NimLearner::getGraph | ( | ) | const | 
Returns a constant reference to the state space graph.
| void NimLearner::labelEdgesFromThreshold | ( | int | threshold | ) | 
Label the edges as "WIN" or "LOSE" based on a threshold.
| std::vector< Edge > NimLearner::playRandomGame | ( | ) | const | 
Plays a random game of Nim, returning the path through the state graph as a vector of Edge classes. 
The origin of the first Edge must be the vertex with the label "p1-#", where # is the number of starting tokens. (For example, in a 10 token game, result[0].origin must be the vertex "p1-10".)