# @types/tictactoejs

> TypeScript definitions for tictactoejs

Latest version **1.0.4** (published 2023-11-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/tictactoejs
pnpm add @types/tictactoejs
yarn add @types/tictactoejs
bun add @types/tictactoejs
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2023-11-07 |
| First published | 2020-03-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51440 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/tictactoejs
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/tictactoejs
- npm.io page: https://npm.io/package/@types/tictactoejs

## Recent versions

- 1.0.4 (latest) — 2023-11-07
- 1.0.2 (ts4.3) — 2023-09-12
- 1.0.1 (ts3.8) — 2021-12-24
- 1.0.0 (ts2.8) — 2020-03-31
- 1.0.3 — 2023-10-18

## README

# Installation
> `npm install --save @types/tictactoejs`

# Summary
This package contains type definitions for tictactoejs (https://www.npmjs.com/package/tictactoejs).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/tictactoejs.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/tictactoejs/index.d.ts)
````ts
export class TicTacToe {
    /**
     * The game's constructor
     */
    constructor(requestSize?: number);
    /**
     * Restart the game
     */
    reset(requestSize?: number): void;
    /**
     * Get the current game's size
     * @returns the game size
     */
    getSize(): number;
    /**
     * Check, whether it's X' turn or O's
     * @returns whose turn it is
     */
    turn(): "X" | "O";
    /**
     * Get the current board
     * @returns the current board as ascii
     */
    ascii(): string;
    /**
     * Get the current board
     * @returns the current board as ascii (alternative style)
     */
    ascii2(): string;
    /**
     * Does a move (bottom left is 1|1, bottom right is 3|1)
     * @returns whether the move was successful
     */
    move(x: number, y: number): boolean;
    /**
     * Check whether the provided coordinates exist on the current board
     * @returns whether the current coordinates exist
     */
    exists(x: number, y: number): boolean;
    /**
     * Check which player occupies the provided coordinates
     * @returns the player occupying these coordinates
     */
    get(x: number, y: number): "X" | "O" | null;
    /**
     * Do a move with array style coordinates (top left is 0|0, top right is 0|2)
     * @returns whether the move was successful
     */
    moveArray(row: number, col: number): boolean;
    /**
     * Check the game's current state
     * @returns the game state
     */
    status(): "X" | "O" | "draw" | "in progress";
    /**
     * Check whether the game is over
     * @returns the game state
     */
    gameOver(): boolean;
    /**
     * Check whether the game ended in a draw
     * @returns the game state
     */
    isDraw(): boolean;
    /**
     * Check the valid moves (all unoccupied coordinates)
     * @returns an array of objects with the x and y values
     */
    legalMoves(): [{ x: number; y: number }];
    /**
     * Do a random move (no logic or AI involved, this is completely random)
     * @returns an object with the x and y value of the random move
     */
    randomMove(): { x: number; y: number };
}

````

### Additional Details
 * Last updated: Tue, 07 Nov 2023 15:11:36 GMT
 * Dependencies: none

# Credits
These definitions were written by .

---
_Source: https://npm.io/package/@types/tictactoejs · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
