<commit_before>require "meiro/tile_manager"
require "meiro/tile_manager/binary_tile_manager"
require "meiro/tile_manager/detailed_tile_manager"
require "meiro/tile_manager/rogue_like_tile_manager"

module Meiro
  module Tile
    TYPE = {
      wall: 0,
      flat: 1,
      gate: 2,
    }

    module ModuleMethods
      def classify(tiles, type)
        case type
        when :rogue_like
          RogueLikeTileManager.classify(tiles)
        when :detail
          DetailedTileManager.classify(tiles)
        when :binary
          BinaryTileManager.classify(tiles)
        else
          tiles[1, 1]
        end
      end

      def wall
        TileManager.wall
      end

      def flat
        TileManager.flat
      end

      def gate
        TileManager.gate
      end

      def passage
        TileManager.passage
      end
    end
    extend ModuleMethods

    class BaseTile
      class << self
        def register_type(symbol)
          @type = symbol
        end

        def register_sign(sign)
          @sign = sign
        end

        def walkable(bool)
          @walkable = !!bool
        end
      end

      def type
        self.class.instance_variable_get(:@type)
      end

      def type_is?(symbol)
        self.type == symbol
      end

      def sign
        self.class.instance_variable_get(:@sign)
      end

      def to_s
        sign
      end

      def walkable?
        !!self.class.instance_variable_get(:@walkable)
      end
    end

    class Wall < BaseTile
      register_type :wall
      register_sign ' '
      walkable false
    end

    class Flat < BaseTile
      register_type :flat
      register_sign '.'
      walkable true
    end
<commit_msg>Tile系を継承しやすいよう修正。<commit_after>require "meiro/tile_manager"
require "meiro/tile_manager/binary_tile_manager"
require "meiro/tile_manager/detailed_tile_manager"
require "meiro/tile_manager/rogue_like_tile_manager"

module Meiro
  module Tile
    TYPE = {
      wall: 0,
      flat: 1,
      gate: 2,
    }

    module ModuleMethods
      def classify(tiles, type)
        case type
        when :rogue_like
          RogueLikeTileManager.classify(tiles)
        when :detail
          DetailedTileManager.classify(tiles)
        when :binary
          BinaryTileManager.classify(tiles)
        else
          tiles[1, 1]
        end
      end

      def wall
        TileManager.wall
      end

      def flat
        TileManager.flat
      end

      def gate
        TileManager.gate
      end

      def passage
        TileManager.passage
      end
    end
    extend ModuleMethods

    class BaseTile
      class << self
        def register_type(symbol)
          @type = symbol
        end

        def register_sign(sign)
          @sign = sign
        end

        def walkable(bool)
          @walkable = !!bool
        end
      end

      def type
        self.class.instance_variable_get(:@type) ||
          self.class.superclass.instance_variable_get(:@type)
      end

      def type_is?(symbol)
        self.type == symbol
      end

      def sign
        self.class.instance_variable_get(:@sign) ||
          self.class.superclass.instance_variable_get(:@sign)
      end

      def to_s
        sign
      end

      def walkable?
        !!(self.class.instance_variable_get(:@walkable) ||
           self.class.superclass.instance_variable_get(:@walkable))
      end
    end

    class Wall < BaseTile
      register_type :wall
      register_sign ' '
      walkable false
    end

    class Flat < BaseTile
      register_type :flat
      register_sign '.'
      walkable true
    end

{'fraction_non_alphanumeric': 0.06437291897891231, 'fraction_numerical': 0.002774694783573807, 'mean_word_length': 1.7166541070082895, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6227840', 'n_tokens_mistral': 1107, 'n_tokens_neox': 1058, 'n_words': 241}