Class: Board

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

Instance Method Summary collapse

Constructor Details

#initialize(player1Start) ⇒ Board

To valid and set the size of the board n*n



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/game.rb', line 6

def initialize(player1Start)
  check = false
  while check == false do
    print  "Size of de board nxn: "
    size = gets.chomp.to_i
    if( size != nil and size >0)
      check = true
    else
      print 'Invalid number. '
      gets.chomp
      system('clear')
    end
  end
  controlFlow(size,player1Start)
end

Instance Method Details

#getLastPlayerObject



152
153
154
# File 'lib/game.rb', line 152

public def getLastPlayer
  return @@lastWinner
end