Class: Player

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

Overview

A player, participating at a game

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(color) ⇒ Player

Initializer

Parameters:

  • the

    new player’s color



16
17
18
19
# File 'lib/software_challenge_client/player.rb', line 16

def initialize(color)
  @color = color
  self.points = 0
end

Instance Attribute Details

#colorPlayerColor (readonly)

Returns the player’s color.

Returns:



9
10
11
# File 'lib/software_challenge_client/player.rb', line 9

def color
  @color
end

#pointsInteger

Returns the player’s points.

Returns:

  • (Integer)

    the player’s points



12
13
14
# File 'lib/software_challenge_client/player.rb', line 12

def points
  @points
end

Instance Method Details

#==(another_player) ⇒ Object



21
22
23
# File 'lib/software_challenge_client/player.rb', line 21

def ==(another_player)
  return self.color == another_player.color
end