Class: SGF::Model::Game
- Inherits:
-
Object
- Object
- SGF::Model::Game
- Defined in:
- lib/sgf/model/game.rb
Constant Summary
Constants included from Constants
Constants::BLACK, Constants::DEFAULT_BOARD_SIZE, Constants::DEFAULT_KOMI, Constants::NODE_MOVE, Constants::NODE_PASS, Constants::NODE_SETUP, Constants::POSITIONS, Constants::WEIQI, Constants::WHITE
Instance Attribute Summary collapse
-
#annotation ⇒ Object
Returns the value of attribute annotation.
-
#black_player ⇒ Object
Returns the value of attribute black_player.
-
#black_rank ⇒ Object
Returns the value of attribute black_rank.
-
#black_team ⇒ Object
Returns the value of attribute black_team.
-
#board_size ⇒ Object
Returns the value of attribute board_size.
-
#comment ⇒ Object
Returns the value of attribute comment.
-
#event ⇒ Object
Returns the value of attribute event.
-
#game_type ⇒ Object
Returns the value of attribute game_type.
-
#handicap ⇒ Object
Returns the value of attribute handicap.
-
#komi ⇒ Object
Returns the value of attribute komi.
-
#name ⇒ Object
Returns the value of attribute name.
-
#overtime_rule ⇒ Object
Returns the value of attribute overtime_rule.
-
#place ⇒ Object
Returns the value of attribute place.
-
#played_on ⇒ Object
Returns the value of attribute played_on.
-
#program ⇒ Object
Returns the value of attribute program.
-
#result ⇒ Object
Returns the value of attribute result.
-
#round ⇒ Object
Returns the value of attribute round.
-
#rule ⇒ Object
Returns the value of attribute rule.
-
#source ⇒ Object
Returns the value of attribute source.
-
#time_rule ⇒ Object
Returns the value of attribute time_rule.
-
#white_player ⇒ Object
Returns the value of attribute white_player.
-
#white_rank ⇒ Object
Returns the value of attribute white_rank.
-
#white_team ⇒ Object
Returns the value of attribute white_team.
Instance Method Summary collapse
-
#initialize ⇒ Game
constructor
A new instance of Game.
- #misc_properties ⇒ Object
- #moves ⇒ Object
- #root_node ⇒ Object
Methods included from SGFHelper
#move_to_sgf, #to_label, #to_position, #to_position_array, #xy_to_sgf_pos
Constructor Details
#initialize ⇒ Game
Returns a new instance of Game.
14 15 16 17 18 19 |
# File 'lib/sgf/model/game.rb', line 14 def initialize @game_type = WEIQI @board_size = DEFAULT_BOARD_SIZE @handicap = 0 @komi = DEFAULT_KOMI end |
Instance Attribute Details
#annotation ⇒ Object
Returns the value of attribute annotation.
7 8 9 |
# File 'lib/sgf/model/game.rb', line 7 def annotation @annotation end |
#black_player ⇒ Object
Returns the value of attribute black_player.
7 8 9 |
# File 'lib/sgf/model/game.rb', line 7 def black_player @black_player end |
#black_rank ⇒ Object
Returns the value of attribute black_rank.
7 8 9 |
# File 'lib/sgf/model/game.rb', line 7 def black_rank @black_rank end |
#black_team ⇒ Object
Returns the value of attribute black_team.
7 8 9 |
# File 'lib/sgf/model/game.rb', line 7 def black_team @black_team end |
#board_size ⇒ Object
Returns the value of attribute board_size.
7 8 9 |
# File 'lib/sgf/model/game.rb', line 7 def board_size @board_size end |
#comment ⇒ Object
Returns the value of attribute comment.
7 8 9 |
# File 'lib/sgf/model/game.rb', line 7 def comment @comment end |
#event ⇒ Object
Returns the value of attribute event.
7 8 9 |
# File 'lib/sgf/model/game.rb', line 7 def event @event end |
#game_type ⇒ Object
Returns the value of attribute game_type.
7 8 9 |
# File 'lib/sgf/model/game.rb', line 7 def game_type @game_type end |
#handicap ⇒ Object
Returns the value of attribute handicap.
7 8 9 |
# File 'lib/sgf/model/game.rb', line 7 def handicap @handicap end |
#komi ⇒ Object
Returns the value of attribute komi.
7 8 9 |
# File 'lib/sgf/model/game.rb', line 7 def komi @komi end |
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/sgf/model/game.rb', line 7 def name @name end |
#overtime_rule ⇒ Object
Returns the value of attribute overtime_rule.
7 8 9 |
# File 'lib/sgf/model/game.rb', line 7 def overtime_rule @overtime_rule end |
#place ⇒ Object
Returns the value of attribute place.
7 8 9 |
# File 'lib/sgf/model/game.rb', line 7 def place @place end |
#played_on ⇒ Object
Returns the value of attribute played_on.
7 8 9 |
# File 'lib/sgf/model/game.rb', line 7 def played_on @played_on end |
#program ⇒ Object
Returns the value of attribute program.
7 8 9 |
# File 'lib/sgf/model/game.rb', line 7 def program @program end |
#result ⇒ Object
Returns the value of attribute result.
7 8 9 |
# File 'lib/sgf/model/game.rb', line 7 def result @result end |
#round ⇒ Object
Returns the value of attribute round.
7 8 9 |
# File 'lib/sgf/model/game.rb', line 7 def round @round end |
#rule ⇒ Object
Returns the value of attribute rule.
7 8 9 |
# File 'lib/sgf/model/game.rb', line 7 def rule @rule end |
#source ⇒ Object
Returns the value of attribute source.
7 8 9 |
# File 'lib/sgf/model/game.rb', line 7 def source @source end |
#time_rule ⇒ Object
Returns the value of attribute time_rule.
7 8 9 |
# File 'lib/sgf/model/game.rb', line 7 def time_rule @time_rule end |
#white_player ⇒ Object
Returns the value of attribute white_player.
7 8 9 |
# File 'lib/sgf/model/game.rb', line 7 def white_player @white_player end |
#white_rank ⇒ Object
Returns the value of attribute white_rank.
7 8 9 |
# File 'lib/sgf/model/game.rb', line 7 def white_rank @white_rank end |
#white_team ⇒ Object
Returns the value of attribute white_team.
7 8 9 |
# File 'lib/sgf/model/game.rb', line 7 def white_team @white_team end |
Instance Method Details
#misc_properties ⇒ Object
21 22 23 |
# File 'lib/sgf/model/game.rb', line 21 def misc_properties @misc_properties ||= {} end |
#moves ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/sgf/model/game.rb', line 38 def moves moves = 0 node = root_node while node moves = node.move_no node = node.children[0] end moves end |