@rbxts/tic-tac-toe
Version:
Modular tic-tac-toe without dependencies, because why not.
42 lines (41 loc) • 1.36 kB
TypeScript
import { TicTacToeGame } from "../TicTacToeGame";
import { TicTacToeOutput } from "./TicTacToeOutput";
/**
* A output handler that converts the game into a string grid.
* This is mainly for example purposes of use cases for an output handler.
*/
export declare class TicTacToeStringOutput implements TicTacToeOutput {
private sep;
private channel;
/**
* Constructs a new TicTacToeStringOutput.
*
* @param sep The string to use to outline the grid and separate cells.
* @param channel The channel to output to.
*/
constructor(sep: string, channel: (res: string) => void);
/** @hidden */
onMove(tttGame: TicTacToeGame): void;
/** @hidden */
onGameOver(tttGame: TicTacToeGame): void;
/** @hidden */
onGameStart(tttGame: TicTacToeGame): void;
/**
* Constructs a string representation of the given game
* and outputs it to the channel.
*
* @param tttGame The game to output.
*/
private output;
/**
* Constructs a string representation of the given board.
*
* @param board The board to output.
* @returns An array of lines representing the board lines.
*/
private constructBoardLines;
/**
* Returns a string representation of the given symbol.
*/
private getSymbolString;
}