Class: Player

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

Overview

A player, participating at a game

Author:

  • Ralf-Tobias Diekert

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(color) ⇒ Player

Initializer

Parameters:

  • the

    new player’s color



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

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

Instance Attribute Details

#colorPlayerColor (readonly)

Returns the player’s color.

Returns:



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

def color
  @color
end

#pointsInteger

Returns the player’s points.

Returns:

  • (Integer)

    the player’s points



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

def points
  @points
end

Instance Method Details

#==(another_player) ⇒ Object



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

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