class TicTacToe::Player

Constants

COLOR_SET

Attributes

color[R]
name[R]
symbol[R]

Public Class Methods

new(params = {}) click to toggle source
# File lib/tic_tac_toe.rb, line 20
def initialize params = {}
  @@num_of_registered_players += 1
  @color = @@color.next
  @name = params[:name] || "Player " + @@num_of_registered_players.to_s
  symbol = params[:symbol]
  @symbol = STYLE == :off ? symbol : "\e[#{color}m#{symbol}\e[0m"
end

Public Instance Methods

wins() click to toggle source
# File lib/tic_tac_toe.rb, line 28
def wins
  puts "#{name} wins!"
end