# connect4-lib

> Library that handles the game logic for Connect Four

Latest version **2.0.0** (published 2017-07-03) · ISC license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install connect4-lib
pnpm add connect4-lib
yarn add connect4-lib
bun add connect4-lib
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2017-07-03 |
| First published | 2017-06-15 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Jennifer Penfield |
| Maintainers | jpenfield |

## Links

- npm: https://www.npmjs.com/package/connect4-lib
- Repository: https://github.com/jennypenfield/connect-four-lib
- Homepage: https://github.com/jennypenfield/connect-four-lib#readme
- Issues: https://github.com/jennypenfield/connect-four-lib/issues
- npm.io page: https://npm.io/package/connect4-lib

## Recent versions

- 2.0.0 (latest) — 2017-07-03
- 1.0.1 — 2017-07-02
- 1.0.0 — 2017-06-15
- 0.1.0 — 2017-06-15

## README

# Connect Four Library [![Build Status](https://travis-ci.org/jennypenfield/connect-four-lib.svg?branch=master)]
(https://travis-ci.org/jennypenfield/connect-four-lib)

This is a project to implement the game logic for the classic game
[Connect Four].

This is a collaborative project of the students of the [The Iron Yard Houston]
front-end class.

## Development Setup

Install [Yarn], then from this directory:

```sh
# install node_modules folder
yarn install

# run the test suite
yarn test
```

## API Documentation

#### `Connect4Lib.EMPTY_BOARD`
> Creates a 7x6 array of null elements.

### The Connect4 Library has two public functions:
* [gameStatus(board)](#c4gameStatus)
* [validBoard(board)](#c4validBoard)

#### <a name='c4gameStatus'></a>`gameStatus(board)`
* This method needs to receive an array (the 'board') as an argument.
* The library uses a private method to determine the board's winning coordinates.

This method returns:
* {status: 'winner_red', coordinates: coord} if there is a red winner.
* {status: 'winner_yellow', coordinates: coord} if there is a yellow winner.
* {status: 'tie'} or {status: 'in_progress'}, depending
on the current status of the game.

#### <a name='c4validBoard'></a>`validBoard(board)`
This method needs to receive an array (the 'board') as an argument.
The method returns false if the board passed is not an array, if the board does not have seven columns, or if the rows are invalid. The method returns true if preceding conditions are not met.

## License

[ISC License]

[Connect Four]:https://en.wikipedia.org/wiki/Connect_Four
[The Iron Yard Houston]:https://www.theironyard.com/locations/houston
[Yarn]:https://yarnpkg.com
[ISC License]:LICENSE.md

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