Class: Piece
- Inherits:
-
Object
show all
- Includes:
- Constants
- Defined in:
- lib/software_challenge_client/piece.rb
Overview
Ein Spielstein mit Ausrichtung, Koordinaten und Farbe
Constant Summary
Constants included
from Constants
Constants::BOARD_SIZE, Constants::GAME_IDENTIFIER, Constants::ROUND_LIMIT
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(team, coords = Coordinates.origin) ⇒ Piece
Erstellt einen neuen Spielstein.
18
19
20
21
|
# File 'lib/software_challenge_client/piece.rb', line 18
def initialize(team, coords = Coordinates.origin)
@team = team
@coords = coords
end
|
Instance Attribute Details
15
16
17
|
# File 'lib/software_challenge_client/piece.rb', line 15
def coords
@coords
end
|
15
|
# File 'lib/software_challenge_client/piece.rb', line 15
attr_accessor :coords
|
11
|
# File 'lib/software_challenge_client/piece.rb', line 11
attr_accessor :team
|
11
12
13
|
# File 'lib/software_challenge_client/piece.rb', line 11
def team
@team
end
|
Instance Method Details
#==(other) ⇒ Object
23
24
25
26
27
|
# File 'lib/software_challenge_client/piece.rb', line 23
def ==(other)
!other.nil? &&
team == other.team &&
coords == other.coords
end
|
#inspect ⇒ Object
40
41
42
|
# File 'lib/software_challenge_client/piece.rb', line 40
def inspect
to_s
end
|
#to_s ⇒ String
30
31
32
|
# File 'lib/software_challenge_client/piece.rb', line 30
def to_s
"#{team.key} at #{coords}"
end
|
#to_ss ⇒ String
36
37
38
|
# File 'lib/software_challenge_client/piece.rb', line 36
def to_ss
"#{team.key.to_s[0]}"
end
|