TicTacToeUtils

com.phasmidsoftware.gambit.examples.tictactoe.TicTacToeUtils

Shared utility methods for TicTacToe cell operations.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def cellFromDiff(diff: Int): Int

Given a board diff with exactly one cell changed, return its flat cell index (0..8, row-major). The diff is the XOR of two board values where exactly one cell differs.

Given a board diff with exactly one cell changed, return its flat cell index (0..8, row-major). The diff is the XOR of two board values where exactly one cell differs.

Value parameters

diff

the XOR of two board values.

Attributes

Returns

the flat cell index (0..8) of the changed cell.

Throws
RuntimeException

if no changed cell is found.