<commit_before>module SparkleMotion
  # Base class representing the state of an ordered set of lights, with an ability to debug
  # things via PNG dump.
  class Node
    FRAME_PERIOD  = 0.4
    DEBUG_SCALE   = Vector2.new(2, 6)

    attr_accessor :history, :debug, :lights

    def initialize(lights:)
      @lights   = lights
      @state    = Array.new(@lights)
      lights.times do |n|
        @state[n] = 0.0
      end
    end

    def debug=(val)
      @debug = val
      @history ||= [] if @debug
    end

    def [](n); @state[n]; end
    def []=(n, val); @state[n] = val; end

    def update(t)
      return unless @debug
      prev_t  = @history.last
      prev_t  = prev_t ? prev_t[:t] : t
      @history << { t:     t,
                    dt:    t - prev_t,
                    state: (0..(@lights - 1)).map { |n| self[n] } }<commit_msg>Run simulation MUCH faster for clearer visualization.<commit_after>module SparkleMotion
  # Base class representing the state of an ordered set of lights, with an ability to debug
  # things via PNG dump.
  class Node
    FRAME_PERIOD  = 0.04
    DEBUG_SCALE   = Vector2.new(2, 6)

    attr_accessor :history, :debug, :lights

    def initialize(lights:)
      @lights   = lights
      @state    = Array.new(@lights)
      lights.times do |n|
        @state[n] = 0.0
      end
    end

    def debug=(val)
      @debug = val
      @history ||= [] if @debug
    end

    def [](n); @state[n]; end
    def []=(n, val); @state[n] = val; end

    def update(t)
      return unless @debug
      prev_t  = @history.last
      prev_t  = prev_t ? prev_t[:t] : t
      @history << { t:     t,
                    dt:    t - prev_t,
                    state: (0..(@lights - 1)).map { |n| self[n] } }
{'fraction_non_alphanumeric': 0.12593444508338125, 'fraction_numerical': 0.010925819436457734, 'mean_word_length': 1.9096989966555185, 'pattern_counts': {'":': 0, '<': 7, '<?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': '4708522', 'n_tokens_mistral': 614, 'n_tokens_neox': 575, 'n_words': 178}