GameAPI

GameAPI
class GameAPI

A game of chess.

A game is played between two players, white and black.

Attributes

Todo

add clocks

keep move orders somewhere

draw rules (50 moves, 3 positions)

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def board: Board

Access the board of the game.

Access the board of the game.

Attributes

Returns

The board.

def convertForFrontend(): Map[String, PieceInformation]
def convertPos(input: String): (Int, Int)

Convert a string position to its int tuple equivalent.

Convert a string position to its int tuple equivalent.

The given string is suppose to already be of good quality.

Value parameters

input

The string position to convert.

Attributes

Returns

The square coordinate in matrix conventions.

def initialize(): Unit
def play(selectedSquare: String, targetSquare: String, promotion: String): Map[String, PieceInformation]

Play a turn of chess.

Play a turn of chess.

The function start by verifying if the game is not over (checkmate or stalemate).

If not, the player of which it's the turn pick a piece and then pick a position to move this piece.

Attributes

def setWinner(newWinner: String): Unit
def timesPlay: Map[String, Array[Long]]
def turn: String
def validPosition(input: String): Boolean

Check if the input position is of the right format.

Check if the input position is of the right format.

This function checks if the given position is a correct chess square, i.e of the form a1 -> h8

Value parameters

input

The given input.

Attributes

Returns

true if the input is a correct position, false otherwise.

def winner: String

Access the winner of the game.

Access the winner of the game.

If it's a stalemate, the winner is set to "_"

Attributes

Returns

The winner.

Concrete fields

val colorPiece: String => List[Piece]

A list of all the pieces of the given color.

A list of all the pieces of the given color.

Attributes