

class StatObserver

  attr_reader :buffer

  def initialize
#     $igsClient.add_listener(IGSProtocol::INFO) { |code,line| rec_info(line) }
    @updating= false
  end

  def rec_info(line)
    if line =~ /^Player:/
      @buffer= [line]
    elsif line =~ /^Defaults/
      @buffer.push(line)
      @rec_stats= Stats.new( PlayerStats.new(@buffer))
      @buffer= nil
    elsif @buffer
      @buffer.push(line)
    elsif line =~ /^Verbose/
      @verbose= line
    elsif @verbose
      @rec_stats.rec_opts(@verbose,line)
      @verbose=nil
    end
  end

end




