Sha256: 509b33c41f21befe6b8574e6cf3576fd713a89e6b5c683a33473b8145e0802e6

Contents?: true

Size: 1.21 KB

Versions: 9

Compression:

Stored size: 1.21 KB

Contents

# frozen-string-literal: true

module Bioshogi
  class HandLog
    include SimpleModel

    attr_accessor :drop_hand
    attr_accessor :move_hand

    attr_accessor :candidate_soldiers
    attr_accessor :place_same
    attr_accessor :skill_set
    attr_accessor :handicap

    attr_accessor :single_clock

    delegate :soldier, to: :hand

    def to_kif(options = {})
      options = {
        :with_location => false,
        :char_type     => :formal_sheet,
      }.merge(options)

      hand.to_kif(options)
    end

    def to_ki2(...)
      official_formatter(...).to_s
    end

    def yomiage(...)
      yomiage_formatter(...).to_s
    end

    def to_csa(...)
      hand.to_csa(...)
    end

    def to_sfen(...)
      hand.to_sfen(...)
    end

    def to_akf(...)
      hand.to_akf(...)
    end

    def to_kif_ki2
      [to_kif, to_ki2]
    end

    def to_kif_ki2_csa
      [to_kif, to_ki2, to_csa]
    end

    def to_skill_set_kif_comment(options = {})
      skill_set.kif_comment(soldier.location)
    end

    def hand
      move_hand || drop_hand
    end

    def official_formatter(...)
      OfficialFormatter.new(self, ...)
    end

    def yomiage_formatter(...)
      Yomiage::Formatter.new(self, ...)
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
bioshogi-0.0.15 lib/bioshogi/hand_log.rb
bioshogi-0.0.14 lib/bioshogi/hand_log.rb
bioshogi-0.0.10 lib/bioshogi/hand_log.rb
bioshogi-0.0.9 lib/bioshogi/hand_log.rb
bioshogi-0.0.8 lib/bioshogi/hand_log.rb
bioshogi-0.0.7 lib/bioshogi/hand_log.rb
bioshogi-0.0.5 lib/bioshogi/hand_log.rb
bioshogi-0.0.4 lib/bioshogi/hand_log.rb
bioshogi-0.0.3 lib/bioshogi/hand_log.rb