Sha256: b6a745ba332b9be332c9a3be38d5157f74487179c2a3b156b0d6aef60fde3bfb

Contents?: true

Size: 1.02 KB

Versions: 7

Compression:

Stored size: 1.02 KB

Contents

# frozen-string-literal: true

module Bioshogi
  module Container
    concern :ExecuteMethods do
      # Simple では使ってないメソッド
      concerning :HumanMethods do
        included do
          delegate :to_kif_a, :to_ki2_a, :to_kif_oneline, to: :hand_logs
        end

        attr_writer :kill_count      # 駒を取った回数
        attr_accessor :critical_turn # 最初の駒が取られる直前の手数           (avg: 21.6328)
        attr_accessor :outbreak_turn # 「歩と角」を除く駒が取られる直前の手数 (avg: 41.8402)

        def kill_count
          @kill_count ||= 0
        end

        def hand_logs
          @hand_logs ||= HandLogs.new([])
        end
      end

      def execute(str, options = {})
        options = {
          executor_class: executor_class,
        }.merge(options)

        InputParser.scan(str).each do |str|
          current_player.execute(str, options)
        end
      end

      def executor_class
        PlayerExecutor::Human
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
bioshogi-0.0.10 lib/bioshogi/container/execute_methods.rb
bioshogi-0.0.9 lib/bioshogi/container/execute_methods.rb
bioshogi-0.0.8 lib/bioshogi/container/execute_methods.rb
bioshogi-0.0.7 lib/bioshogi/container/execute_methods.rb
bioshogi-0.0.5 lib/bioshogi/container/execute_methods.rb
bioshogi-0.0.4 lib/bioshogi/container/execute_methods.rb
bioshogi-0.0.3 lib/bioshogi/container/execute_methods.rb