Tic Tac Toe Game Implementation
agorneo
11.4K views
Welcome!
Tic-tac-toe (American English), noughts and crosses (British English) or Xs and Os, is a paper-and-pencil game for two players, X and O, who take turns marking the spaces in a 3×3 grid.
The player who succeeds in placing three of their marks in a horizontal, vertical, or diagonal row wins the game.
Hands-on Code
Playing...
1
2
3
4
5
6
7
require_relative 'tic_tac_toe.rb'
# board = ["X", "X", "X", "X", "O", "O", "X", "O", "O"]
# game = TicTacToe.new(board)
game = TicTacToe.new
game.display_board
game.play
1
class TicTacToe
Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.