https://github.com/mitulmanish/tictactoe_in_ruby
TicTacToe (Simple n X n board game)
https://github.com/mitulmanish/tictactoe_in_ruby
board game rspec-spec ruby tic-tac-toe
Last synced: about 2 months ago
JSON representation
TicTacToe (Simple n X n board game)
- Host: GitHub
- URL: https://github.com/mitulmanish/tictactoe_in_ruby
- Owner: mitulmanish
- Created: 2015-10-20T14:00:02.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-07-01T07:34:02.000Z (about 10 years ago)
- Last Synced: 2025-08-24T15:59:46.596Z (11 months ago)
- Topics: board, game, rspec-spec, ruby, tic-tac-toe
- Language: Ruby
- Homepage:
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
##TicTacToe Game
To run the script ,please navigate to the root of the folder.
- Run “ bundle install “ to install the dependencies
- Run “ ruby run.rb” to run the program
- Run “ rspec spec/board_spec.rb “ to run the board test script
- Run “ rspec spec/player_spec.rb “ to run the player test script
# tictactoe_in_ruby
TicTacToe (Simple 3 X 3 board game)
## tic-tac-toe
Using a language of your choosing, you will need to create a slightly simplified nxn tic-tac-toe game.
Your initial 'board' is a grid of nxn squares. As game play progresses,
each square can get filled by an 'X', 'O', or remain empty - just like normal
tic-tac-toe. The game is won with three in a row of 'X' or 'O' in any
direction, _not_ including diagonals (that's the simplification).
You will have one 'board', through which the players will play.
Here's an example of how the board might be used to play through a game (in Ruby):
def playgame
board = Board.new(3)
board.square_is(1, 1, 'X')
board.square_is(1, 0, 'O')
board.square_is(0, 1, 'X')
board.square_is(2, 1, 'O')
board.square_is(0, 2, 'X')
board.square_is(2, 0, 'O')
# check for a winner - won't find one.
board.square_is(0, 0, 'X')
# check for a winner - X has won.
end