Sha256: d5daa0f5a2b60c312805d908b9e61be62c0a3ddb75fc8fdc819bfdee3b022a3a
Contents?: true
Size: 754 Bytes
Versions: 9
Compression:
Stored size: 754 Bytes
Contents
# frozen-string-literal: true module Bioshogi module Parser class SfenParser < Base class << self def accept?(source) str = Source.wrap(source).to_s str.match?(/^(?:position|sfen)\b/i) || (str.lines.one? && Sfen.accept?(str)) end end def parse @pi.sfen_info = Sfen.parse(normalized_source) @pi.move_infos = @pi.sfen_info.move_infos @pi.force_handicap = @pi.sfen_info.handicap? @pi.sfen_info.piece_counts.each do |location_key, counts| location = Location.fetch(location_key) name = location.call_name(@pi.sfen_info.handicap?) @pi.header["#{name}の持駒"] = Piece.h_to_s(counts) end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems