Class: Sashite::Cpn::Turn

Inherits:
Object
  • Object
show all
Defined in:
lib/sashite/cpn/turn.rb

Overview

Turn class.

Instance Method Summary collapse

Constructor Details

#initialize(b) ⇒ Turn

Returns a new instance of Turn.

Parameters:

  • b (Boolean)

    The turn to play (topside: true, bottomside: false).



8
9
10
# File 'lib/sashite/cpn/turn.rb', line 8

def initialize(b)
  @b = b
end

Instance Method Details

#to_sString

Returns A string representation.

Returns:

  • (String)

    A string representation.



18
19
20
21
22
23
24
# File 'lib/sashite/cpn/turn.rb', line 18

def to_s
  if turn_to_topside?
    't'
  else
    'B'
  end
end

#turn_to_topside?Boolean

Returns false when the turn to play is for bottom.

Returns:

  • (Boolean)

    Returns false when the turn to play is for bottom.



13
14
15
# File 'lib/sashite/cpn/turn.rb', line 13

def turn_to_topside?
  @b
end