Tic-tac-toe
A Tic-tac-toe game that never loses.
Installation
Add this line to your application's Gemfile:
gem 'tic_tac_toe_mchliakh'
And then execute:
$ bundle
Or install it yourself as:
$ gem install tic_tac_toe_mchliakh
Usage
class GamesController < ApplicationController
def new
render json: Game.create.id
end
def move
game = Game.find(params[:id])
result = TicTacToe.move(square, game.board)
if result[:board]
game.update_attributes(board: result[:board])
end
render json: result
end
end
- Fork it ( https://github.com/[my-github-username]/tic_tac_toe_mchliakh/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request