react-tic-tac-toe

1.0.3 • Public • Published

react-tic-tac-toe

A React implementation of Tic Tac Toe for one or two players.

It uses a Monte Carlo simulation to power the AI in single-player mode.

Demo & Examples

Live demo: negomi.github.io/react-tic-tac-toe

To build the examples locally, run:

npm install
npm start

Then open localhost:8080/webpack-dev-server/ in a browser.

Tests

To run the tests with a watcher, run:

npm test

Then open localhost:8000/webpack-dev-server/test/ in a browser.

Installation

Requires React 0.14

The easiest way to use react-tic-tac-toe is to install it from npm and include it in your own React build process (using Browserify, Webpack, etc).

You can also use the standalone build by including dist/TicTacToe.js or dist/TicTacToe.min.js in your page. If you use this, make sure you have already included React, and that it is available as a global variable.

npm install react-tic-tac-toe --save

Usage

var TicTacToe = require('react-tic-tac-toe');
 
ReactDOM.render(<TicTacToe width={ 3 } singlePlayer />, document.getElementById('app'));

Properties

Property Type Default Function
singlePlayer boolean false Specify this flag to trigger single-player mode
width number 3 Determines the size of the board

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.3
    2
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.3
    2
  • 1.0.2
    1
  • 1.0.1
    1
  • 1.0.0
    1

Package Sidebar

Install

npm i react-tic-tac-toe

Weekly Downloads

5

Version

1.0.3

License

MIT

Last publish

Collaborators

  • negomi