Sha256: 24aeaed7c27dfbdfaea6825807c2d3b1b9b480546487512e7d11234235f2ea1b

Contents?: true

Size: 566 Bytes

Versions: 8

Compression:

Stored size: 566 Bytes

Contents

# frozen-string-literal: true

module Bioshogi
  module Dimension
    class PlaceX < Base
      class << self
        # ["1", "2", "3"] -> ["3", "2", "1"].last(2) -> ["2", "1"]
        def char_infos
          @char_infos ||= CharInfo.values.reverse.last(dimension)
        end
      end

      def name
        char_info.number_zenkaku
      end

      def to_sfen
        (self.class.char_infos.size - value).to_s
      end

      # 人間向けの数字で 68 なら 6
      def to_human_int
        self.class.char_infos.size - value
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

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