Case class to represent a TicTacToe state (layout).
Value parameters
- board
-
the current state.
- maybePrior
-
the prior state.
Attributes
- Companion
- object
- Graph
-
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Members list
Type members
Types
Defines a Matching type which takes a Row and returns a Cell.
Defines a Matching type which takes a Row and returns a Cell.
Attributes
Value members
Concrete methods
Method to determine if this layout is a draw, i.e. no side can ever win.
Method to determine if this layout is a draw, i.e. no side can ever win.
TODO figure out a better way to determine a draw.
Attributes
- Returns
-
Some(false) if it's a draw, else None.
Equals method based on the board only.
Equals method based on the board only.
Attributes
- Returns
-
Boolean.
- Definition Classes
-
Equals -> Any
HashCode method based on the board only (not prior).
HashCode method based on the board only (not prior).
Attributes
- Returns
-
a hashCode.
- Definition Classes
-
Any
Value parameters
- b1
-
a Board.
- b2
-
another Board.
Attributes
- Returns
-
true if the XOR of the two boards masked by mask is equal to pattern.
Value parameters
- opponent
-
if
truethen the opposite corner must be the opponent.
Attributes
- Returns
-
true if this
TicTacToeis a corner position and if the opponent (if true, else self) occupies the opposite corner.
Method to create a new TicTacToe from this TicTacToe.
Method to create a new TicTacToe from this TicTacToe.
Value parameters
- col
-
the column at which the mark should be made.
- row
-
the row at which the mark should be made.
- xOrO
-
true if X is to play, false otherwise.
Attributes
- Returns
-
a new Board with the appropriate cell (i.e., square) marked.
Function to make a play for the 0 player at a cell.
Function to make a play for the 0 player at a cell.
Attributes
Function to make a play for the X player at a cell.
Function to make a play for the X player at a cell.
Attributes
Method to create a string of Xs and 0s corresponding to this TicTacToe position. Also includes the heuristic for the position.
Method to create a string of Xs and 0s corresponding to this TicTacToe position. Also includes the heuristic for the position.
CONSIDER adding a parameter to allow dropping the heuristic.
Attributes
- Returns
-
a String that is a rendition of the current state.
Inherited methods
Attributes
- Inherited from:
- Product
Attributes
- Inherited from:
- Product
Concrete fields
Method to determine whether there is a block by one player against his opponent.. The line may be horizontal (a row), vertical (a column) or diagonal.
Method to determine whether there is a block by one player against his opponent.. The line may be horizontal (a row), vertical (a column) or diagonal.
Attributes
- Returns
-
Some(b) if there is a line of 0X0 or similar otherwise None. The Boolean b is true for player X, and false for player 0.
Method to determine whether there are two potential wins. The lines may be horizontal (a row), vertical (a column) or diagonal and missing one element.
Method to determine whether there are two potential wins. The lines may be horizontal (a row), vertical (a column) or diagonal and missing one element.
Attributes
- Returns
-
true if there is a line of two similar marks with a space between in this TicTacToe. The Boolean b is true for player X, and false for player 0.
The history of a TicTacToe position, as a String.
The history of a TicTacToe position, as a String.
NOTE: it seems that this is a general method, not specific to TicTacToe
Attributes
The list of open cells for this TicTacToe.
The list of open cells for this TicTacToe.
Attributes
- Returns
-
a sequence of (Int, Int) tuples corresponding to the row, column indices.
Method to determine which player was responsible for creating this state. The empty state will yield false (0 player). A goal state will yield the winner.
Method to determine which player was responsible for creating this state. The empty state will yield false (0 player). A goal state will yield the winner.
Attributes
- Returns
-
true for the first player (X), false for the second player (0)
Method to determine whether there is a potential win. The line may be horizontal (a row), vertical (a column) or diagonal and missing one element.
Method to determine whether there is a potential win. The line may be horizontal (a row), vertical (a column) or diagonal and missing one element.
Attributes
- Returns
-
true if there is a line of two similar marks with a space between in this TicTacToe. The Boolean b is true for player X, and false for player 0.
Method to determine whether there is a line of marks for one player. The line may be horizontal (a row), vertical (a column) or diagonal.
Method to determine whether there is a line of marks for one player. The line may be horizontal (a row), vertical (a column) or diagonal.
Attributes
- Returns
-
Some(b) if there is a line of similar marks in this
TicTacToeotherwiseNone. TheBooleanb is true for player X, and false for player 0.