# tic-tac-toe-detect-winner

> find winner in tic-tac-toe game

Latest version **1.0.2** (published 2019-08-06) · ISC license · 0 weekly downloads

## Install

```sh
npm install tic-tac-toe-detect-winner
pnpm add tic-tac-toe-detect-winner
yarn add tic-tac-toe-detect-winner
bun add tic-tac-toe-detect-winner
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2019-08-06 |
| First published | 2019-08-06 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 8.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | AMNeverova |
| Maintainers | amneverova |

## Links

- npm: https://www.npmjs.com/package/tic-tac-toe-detect-winner
- Repository: https://github.com/AMNeverova/tic-tac-toe-winner
- Homepage: https://github.com/AMNeverova/tic-tac-toe-winner#readme
- Issues: https://github.com/AMNeverova/tic-tac-toe-winner/issues
- npm.io page: https://npm.io/package/tic-tac-toe-detect-winner

## Recent versions

- 1.0.2 (latest) — 2019-08-06
- 1.0.1 — 2019-08-06
- 1.0.0 — 2019-08-06

## README

The library contains a function which detects a winner in tic-tac-toe game.  

The function takes two parameters:  

1. The field in the form of two-dimensional array with length equal to the number of rows & columns in the field. The  symbol representing a cross or a zero can be any user-defined token or a string. An empty cell in the field should   be represented by an empty array element or an empty string.  

2. A number defining the quantity of symbols in succession to be considered as a win.    

The function returns an object with the following properties:

* **winnerDetected**, boolean, which is false in case of draw game;  
    
* **winnerSymbol**, number or string;    
    
* **location**, two-dimensional array where each element is an array with a row & column number of the cell   containing one of the symbols in winning combination;
    
* **lastPoint**, an array with the number of the row & column of the last symbol in wininng combination;    
    
* **type**, string ('row', 'column', 'diagonal-up-right', 'diagonal-up-left' and 'draw game').

---
_Source: https://npm.io/package/tic-tac-toe-detect-winner · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
