Skip to content

Commit

Permalink
Cleaning up the project
Browse files Browse the repository at this point in the history
  • Loading branch information
ZohaibAhmed committed May 18, 2015
1 parent 77c81ba commit 6b7bc9d
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
21 changes: 20 additions & 1 deletion README.md
@@ -1 +1,20 @@
TicTacToe with Flask, Reactjs, Flux, and Redis
# TicTacToe with Flask, Reactjs, Flux, and Redis

A simple tic tac toe game built with Flask, with Flux and Reactjs on the frontend, and Redis to maintain the state of the game.

## Setting it up on your Environment:

1. Clone the repo,
2. Make sure you have Flask installed
3. In the root directory, run `pip install -r requirements.txt`
4. In the root directory, run `npm install`
5. In the root directory, run `bower install`
6. Start the app by running start.sh: `sh start.sh`

## Some questions perhaps?

### Why not just have everything on the client side without Flask or Redis?
A: The server determines the next move for the AI and also maintains the state of the game. This ensures that the player can't cheat their way to a win by modifying anything on the front end.

### Why Flux?
A: Because it's a nice way to maintain the flow of dynamic data throughout the game.
1 change: 1 addition & 0 deletions tictactoe/static/scripts/jsx/components/TicTacToe.js
Expand Up @@ -26,6 +26,7 @@ var TicTacToe = React.createClass({
},

tileClick: function(position, player) {
// Make sure that this only occurs on tiles that aren't occupied, and the game is still in a valid state
if (!TicTacToeStore.isOccupied(position) && !TicTacToeStore.getWinner() && TicTacToeStore.getPlayer() == 'x') {
TicTacToeActions.playPosition(position); // play position
this.setState({tiles: TicTacToeStore.getBoard(), currentPlayer: TicTacToeStore.getPlayer()});
Expand Down
1 change: 0 additions & 1 deletion tictactoe/static/scripts/jsx/stores/TicTacToeStore.js
@@ -1,6 +1,5 @@
var AppDispatcher = require('../dispatcher/AppDispatcher');
var AppConstants = require('../constants/AppConstants')
var TicTacToeApi = require('../utils/TicTacToeApi');
var EventEmitter = require('events').EventEmitter;
var assign = require('object-assign');

Expand Down
6 changes: 0 additions & 6 deletions tictactoe/static/scripts/jsx/utils/TicTacToeApi.js

This file was deleted.

0 comments on commit 6b7bc9d

Please sign in to comment.