Trait that extends the type class State with a concrete underlying type of TicTacToe.
Attributes
- Companion
- object
- Graph
-
- Supertypes
- Known subtypes
-
object TicTacToeState$
Members list
Type members
Inherited classlikes
Attributes
- Inherited from:
- Ordering
- Supertypes
-
class Objecttrait Matchableclass Any
Value members
Concrete methods
Method to construct an S from a proto-state:
Method to construct an S from a proto-state:
Value parameters
- proto
-
a (Board, TicTacToe) tuple.
Attributes
- Returns
-
a TicTacToe.
How close are we to winning?
How close are we to winning?
Value parameters
- s
-
a state.
Attributes
- Returns
-
the number of our aligned cells - their aligned cells.
Have we reached a result? And, if so, who won?
Have we reached a result? And, if so, who won?
Value parameters
- s
-
a (current) state.
Attributes
- Returns
-
an
Option[Boolean]: ifNonethen this state is not a goal state. IfSome(b)then: if b is true, we got a definite result, and the winner is determined by examiningsin more detail. If b is false, we got a partial result, and we should continue to seek a more definite result.
In this game, all states are valid.
In this game, all states are valid.
Value parameters
- s
-
a state.
Attributes
- Returns
-
true.
Method to determine if s is a winning state. NOTE: it makes no sense to invoke isWin unless the result of isGoal is Some(true).
Method to determine if s is a winning state. NOTE: it makes no sense to invoke isWin unless the result of isGoal is Some(true).
Value parameters
- s
-
an S
Attributes
- Returns
-
true if s is a win, else false.
Return all of the possible transitions from the given state.
Return all of the possible transitions from the given state.
CONSIDER refactoring so that we do not discard the state when constructing a Move.
Value parameters
- s
-
a state.
Attributes
- Returns
-
a sequence of Transition[S]
Method to render a State as a String.
Method to render a State as a String.
Value parameters
- s
-
the State to render.
Attributes
- Returns
-
a String representation of s.
a significant sequence value that distinguishes this state from others and which can be derived from a P.
a significant sequence value that distinguishes this state from others and which can be derived from a P.
Value parameters
- s
-
parameter from which we may derive the sequence.
Attributes
Inherited methods
Method to determine the ordering of two States. It is based on the heuristic.
Method to determine the ordering of two States. It is based on the heuristic.
Value parameters
- s1
-
first S.
- s2
-
second S.
Attributes
- Returns
-
<0 if s1 < s2, >0 if s1 > s2, else 0.
- Inherited from:
- State
Attributes
- Definition Classes
-
Ordering -> PartialOrdering -> Equiv
- Inherited from:
- Ordering
Concrete method to get the possible states to follow the given state s. The resulting sequence is in no particular order.
Concrete method to get the possible states to follow the given state s. The resulting sequence is in no particular order.
Value parameters
- s
-
an S.
Attributes
- Returns
-
a sequence of S instances which are the possible states to follow s.
- Inherited from:
- State
Attributes
- Definition Classes
-
Ordering -> PartialOrdering
- Inherited from:
- Ordering
Attributes
- Definition Classes
-
Ordering -> PartialOrdering
- Inherited from:
- Ordering
Returns true if it is the first player's turn to move from state s.
Returns true if it is the first player's turn to move from state s.
To be completely unambiguous: the first player is the one who makes the very first move of the game. isFirstPlayerToMove(s) returns true when it is that player's turn again — e.g., for a two-player game, when an even number of moves have been made (sequence 0, 2, 4, ...).
It returns false when it is the second (or any subsequent) player's turn — i.e., when an odd number of moves have been made (sequence 1, 3, 5, ...).
Example (TicTacToe): empty board (sequence=0) → true (X moves first) after X plays (sequence=1) → false (O moves next) after O plays (sequence=2) → true (X moves next)
For games with more than two players, override this method as needed.
Value parameters
- s
-
the current state.
Attributes
- Returns
-
true if the first player is to move, false otherwise.
- Inherited from:
- State
Attributes
- Inherited from:
- Ordering
Attributes
- Definition Classes
-
Ordering -> PartialOrdering
- Inherited from:
- Ordering
Attributes
- Definition Classes
-
Ordering -> PartialOrdering
- Inherited from:
- Ordering
Attributes
- Inherited from:
- Ordering
Attributes
- Definition Classes
-
Ordering -> PartialOrdering
- Inherited from:
- Ordering
Attributes
- Inherited from:
- Comparator
Attributes
- Inherited from:
- Comparator
Attributes
- Inherited from:
- Comparator
Attributes
- Inherited from:
- Comparator
Attributes
- Inherited from:
- Comparator
Attributes
- Inherited from:
- Comparator
Attributes
- Inherited from:
- Ordering
Implicits
Inherited implicits
Attributes
- Inherited from:
- Ordering