Sha256: 376a7abc346f8b2e5d36c01682c4144e7772a96e005753f92ea69a3d4bd3a4b2

Contents?: true

Size: 499 Bytes

Versions: 9

Compression:

Stored size: 499 Bytes

Contents

# frozen-string-literal: true

module Bioshogi
  module Dimension
    class DimensionInfo
      include ApplicationMemoryRecord
      memory_record [
        { key: :d5x5, name: "5x5", wh: [5, 5], },
        { key: :d9x9, name: "9x9", wh: [9, 9], },
      ]

      class << self
        def lookup(v)
          super || invert_table[v]
        end

        private

        def invert_table
          @invert_table ||= inject({}) {|a, e| a.merge(e.wh => e) }
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

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