Board

class Board

Represents the Tic Tac Toe board. Modified version of LazoCoder's Tic-Tac-Toe Java Implementation, GPLv3 License.

Constructors

Link copied to clipboard
fun Board()

Types

Link copied to clipboard
object Companion
Link copied to clipboard

Functions

Link copied to clipboard
fun move(index: Int): Boolean

Places an X or an O on the specified index depending on whose turn it is.

fun move(x: Int, y: Int): Boolean

Places an X or an O on the specified location depending on who turn it is.

Link copied to clipboard

Places an X or an O on the specified location based on a parameter

Link copied to clipboard
fun reset()

Restart the game with a new blank board.

Link copied to clipboard

Get a copy of the array that represents the board.

Link copied to clipboard
open override fun toString(): String

Properties

Link copied to clipboard
Link copied to clipboard

Get the indexes of all the positions on the board that are empty.

Link copied to clipboard

Get a deep copy of the Tic Tac Toe board.

Link copied to clipboard
var isGameOver: Boolean = false

Check to see if the game is over (if there is a winner or a draw).

Link copied to clipboard

Check to see who's turn it is.

Link copied to clipboard

Check to see who won.