Class: Winner

Inherits:
Object
  • Object
show all
Defined in:
lib/winner.rb

Instance Method Summary collapse

Constructor Details

#initialize(size) ⇒ Winner

To assign the size of the board



5
6
7
# File 'lib/winner.rb', line 5

def initialize(size)
  @@sizeBoard = size
end

Instance Method Details

#countingSymbol(board, symbol) ⇒ Object

To control and check the ways to win the game



10
11
12
13
14
15
16
# File 'lib/winner.rb', line 10

public def countingSymbol(board,symbol)
  return nil if  checkTie(board)
  return true if checkHorizontal(board,symbol)
  return true if checkVertical(board,symbol)
  return true if checkDiagonal(board,symbol)
  return false
end