Sha256: 049f18dfbf5ebbaaff872419de300ecc8dd09ed8b910709ac3974ff4e89b404e

Contents?: true

Size: 376 Bytes

Versions: 2

Compression:

Stored size: 376 Bytes

Contents

#Assuming you have the gem installed, of course
require 'sgf'
parser = SGF::Parser.new

Dir['*.sgf'].each do |file|
  collection = parser.parse File.read(file)
  collection.gametrees.each do |game|
    puts "White player: #{game.white_player} and Black player: #{game.black_player}"
  end
  collection.save file #Because may as well indent the files while I'm here, right?
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
SgfParser-3.0.1 examples/simple_iteration_of_games_in_a_directory.rb
SgfParser-3.0.0 examples/simple_iteration_of_games_in_a_directory.rb