Sha256: 781873adb02afe9bc955051dd1391b29215b9c9b72ff66ebccfbabd33185f8ef

Contents?: true

Size: 992 Bytes

Versions: 2

Compression:

Stored size: 992 Bytes

Contents

# frozen-string-literal: true

module Bioshogi
  module Analysis
    concern :ShapeInfoRelation do
      included do
        delegate :board_parser, :location_split, :sorted_soldiers, to: :shape_info
      end

      def shape_info
        @shape_info ||= ShapeInfo.lookup(key)
      end

      # def shape_infos
      #   if shape_info
      #     shape_infos = []
      #     if respond_to?(:other_shape_keys)
      #       shape_infos = other_shape_keys.collect { |e| ShapeInfo.fetch(e) }
      #     end
      #     [shape_info, *shape_infos]
      #   end
      # end
      #
      # def primary_soldier_hash_table
      #   if shape_info
      #     shape_infos.each_with_object({}) do |e, m|
      #       e.board_parser.primary_soldiers.each_with_object({}) do |s, m|
      #         # soldier 自体をキーにすればほどよく分散できる
      #         m[s] ||= []
      #         m[s] << self
      #       end
      #     end
      #   end
      # end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bioshogi-0.0.15 lib/bioshogi/analysis/shape_info_relation.rb
bioshogi-0.0.14 lib/bioshogi/analysis/shape_info_relation.rb