Closed Tempus closed 12 years ago
I expected game.each do |node| to return nodes starting with the topmost. Instead, if only ever returned the the topmost node. Confirmed loop only went over 1 iteration, yet .inspect showed 319 moves in my sample single branch sgf.
Oh, that's INTERESTING. If you write 'puts' you get nothing interesting, but if you do 'p x.inspect' instead, you do get an output. Doing 'p x' works Doing 'puts x' works but only for the first node.
Interesting stuff. The problem is not with the iterator (I think) but apparently with how I'm organizing the output. I'm still going to look into 'each' implementations just in case.
1.9.3p0 :006 > p 5 5 => 5 1.9.3p0 :007 > puts 5 5 => nil
It actually might well be a bug with the iteration.. I think it's the fact that it returns 'nil'.
Output for both using http://files.gokgs.com/games/2011/11/29/andrew-ninecrane.sgf as source:
#<SGF::Node:2179137740, Children: 1, Parent: true, Properties:{"FF"=>"4", "ST"=>"2", "KM"=>"0.50", "RU"=>"Japanese", "TM"=>"900", "C"=>"andrew [3d]: hi\nninecrane [2d]: hi\n", "AP"=>"CGoban:3", "OT"=>"5x40 byo-yomi", "WR"=>"3d", "BR"=>"2d", "DT"=>"2011-11-29", "GM"=>"1", "SZ"=>"19", "PW"=>"andrew", "PB"=>"ninecrane", "CA"=>"UTF-8", "PC"=>"The KGS Go Server at http://www.gokgs.com/", "RE"=>"B+3.50”}>