https://github.com/sunesimonsen/tic-tac-toe-js
Tic Tac Toe game for fun
https://github.com/sunesimonsen/tic-tac-toe-js
Last synced: 4 months ago
JSON representation
Tic Tac Toe game for fun
- Host: GitHub
- URL: https://github.com/sunesimonsen/tic-tac-toe-js
- Owner: sunesimonsen
- License: mit
- Created: 2016-04-26T18:13:30.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2014-05-13T00:49:11.000Z (about 11 years ago)
- Last Synced: 2025-03-24T21:03:45.403Z (4 months ago)
- Language: JavaScript
- Size: 141 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Tic Tac Toe
JavaScript tic tac toe game.
## Usage
`npm install tic-tac-toe-js`
```
$ node> var Game = require('tic-tac-toe-js').Game;
[Function Game]
> game = new Game;
{ xScore: 0, oScore: 0, winner: null }
> game.move('x', 1);
true
> game.move('o', 9);
true
> game.isFinished();
false
> console.log(game.toString());
X | |
--+---+--
| |
--+---+--
| | O
> game.move('x', 4);
true
> game.move('o', 7);
true
> game.move('x', 4);
true
> console.log(game.toString());
X | X | O
--+---+--
X | |
--+---+--
O | | O
> game.move('x', 6);
true
> game.move('o', 8);
true
> console.log(game.toString());
X | X | O
--+---+--
X | | X
--+---+--
O | O | O
> game.move('x', 5);
false
> game.isFinished()
true
> game.winnner
'O'
```## License
[MIT](https://github.com/benjreinhart/tic-tac-toe-js/blob/master/LICENSE.txt)