Class: JustGo::Chain

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/just_go/chain.rb

Overview

Chain

A collection of Points with stones of the same chain id

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(points: []) ⇒ Chain

Returns a new instance of Chain.



11
12
13
# File 'lib/just_go/chain.rb', line 11

def initialize(points: [])
  @points = points
end

Instance Attribute Details

#pointsObject (readonly)

Returns the value of attribute points.



15
16
17
# File 'lib/just_go/chain.rb', line 15

def points
  @points
end

Instance Method Details

#player_numberObject



19
20
21
# File 'lib/just_go/chain.rb', line 19

def player_number
  points.first.stone.player_number
end