Sha256: 704fcca5af9d535a543cfd7df75b6227080c226e859c66156f7b4f2e51f733f5

Contents?: true

Size: 983 Bytes

Versions: 7

Compression:

Stored size: 983 Bytes

Contents

# frozen-string-literal: true

module Bioshogi
  module Explain
    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 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

7 entries across 7 versions & 1 rubygems

Version Path
bioshogi-0.0.10 lib/bioshogi/explain/shape_info_relation.rb
bioshogi-0.0.9 lib/bioshogi/explain/shape_info_relation.rb
bioshogi-0.0.8 lib/bioshogi/explain/shape_info_relation.rb
bioshogi-0.0.7 lib/bioshogi/explain/shape_info_relation.rb
bioshogi-0.0.5 lib/bioshogi/explain/shape_info_relation.rb
bioshogi-0.0.4 lib/bioshogi/explain/shape_info_relation.rb
bioshogi-0.0.3 lib/bioshogi/explain/shape_info_relation.rb