<commit_before>part of shared;

class MovementSystem extends EntityProcessingSystem {
  Mapper<Position> pm;
  Mapper<Velocity> vm;

  MovementSystem() : super(Aspect.getAspectForAllOf([Position, Velocity]));

  @override
  void processEntity(Entity entity) {
    var p = pm[entity];
    var v = vm[entity];

    p.x = p.x + v.x * world.delta;
    p.y = p.y + v.y * world.delta;
  }
}

class BlockMovementSystem extends EntityProcessingSystem {
  Mapper<Position> pm;

  BlockMovementSystem() : super(Aspect.getAspectForAllOf([Position, BlockType]).exclude([StickyBlock]));

  @override
  void processEntity(Entity entity) {
    pm[entity].y -= 0.5 * world.delta;
  }
}

class BlockConversionSystem extends EntityProcessingSystem {
  Mapper<Position> pm;
  Mapper<FallingBlock> fbm;
  GridManager gm;

  BlockConversionSystem() : super(Aspect.getAspectForAllOf([Position, FallingBlock]));

  @override
  void processEntity(Entity entity) {
    if (pm[entity].y < -0.5) {
      var fb = fbm[entity];
      entity
        ..addComponent(new StickyBlock(fb.col, 0))
        ..removeComponent(FallingBlock)
        ..changedInWorld();
      gm.addStickyBlock(entity);
    }
  }
}

class BlockDestructionSystem extends EntityProcessingSystem {
  Mapper<Position> pm;
  Mapper<FallingBlock> fbm;

  BlockDestructionSystem() : super(Aspect.getAspectForAllOf([Position]).exclude([StickyBlock]));

  @override
  void processEntity(Entity entity) {
    if (pm[entity].y < -1.0) {
      entity.deleteFromWorld();
    }
  }
}

class BeatFactorSystem extends VoidEntitySystem {
  double beatFactor = 1.0;
  List<int> byteFrequencyData;

  BeatFactorSystem(this.byteFrequencyData);

  @override
  void processSystem() {
    beatFactor = byteFrequencyData.reduce(sum) / byteFrequencyData.length;
  }

  int sum(int a, int b) => a + b;
}

class StickyBlockPositionUpdatingSystem extends EntityProcessingSystem {
  Mapper<StickyBlock> sbm;
  Mapper<Position> pm;
  GridManager gm;

  StickyBlockPositionUpdatingSystem() : super(Aspect.getAspectForAllOf([Position, StickyBlock]));

  @override
  void processEntity(Entity entity) {
    var p = pm[entity];
    var sb = sbm[entity];

    p.x = p.x * 0.8 + gm.getColPos(sb.col) * 0.2;
    p.y = p.y * 0.8 + (-0.475 + sb.row * -0.2 * gm.posFactor - 0.02 * gm.sizeFactor * (sb.row + 1)) * 0.2;
  }<commit_msg>limiting the beatFactor<commit_after>part of shared;

class MovementSystem extends EntityProcessingSystem {
  Mapper<Position> pm;
  Mapper<Velocity> vm;

  MovementSystem() : super(Aspect.getAspectForAllOf([Position, Velocity]));

  @override
  void processEntity(Entity entity) {
    var p = pm[entity];
    var v = vm[entity];

    p.x = p.x + v.x * world.delta;
    p.y = p.y + v.y * world.delta;
  }
}

class BlockMovementSystem extends EntityProcessingSystem {
  Mapper<Position> pm;

  BlockMovementSystem() : super(Aspect.getAspectForAllOf([Position, BlockType]).exclude([StickyBlock]));

  @override
  void processEntity(Entity entity) {
    pm[entity].y -= 0.5 * world.delta;
  }
}

class BlockConversionSystem extends EntityProcessingSystem {
  Mapper<Position> pm;
  Mapper<FallingBlock> fbm;
  GridManager gm;

  BlockConversionSystem() : super(Aspect.getAspectForAllOf([Position, FallingBlock]));

  @override
  void processEntity(Entity entity) {
    if (pm[entity].y < -0.5) {
      var fb = fbm[entity];
      entity
        ..addComponent(new StickyBlock(fb.col, 0))
        ..removeComponent(FallingBlock)
        ..changedInWorld();
      gm.addStickyBlock(entity);
    }
  }
}

class BlockDestructionSystem extends EntityProcessingSystem {
  Mapper<Position> pm;
  Mapper<FallingBlock> fbm;

  BlockDestructionSystem() : super(Aspect.getAspectForAllOf([Position]).exclude([StickyBlock]));

  @override
  void processEntity(Entity entity) {
    if (pm[entity].y < -1.0) {
      entity.deleteFromWorld();
    }
  }
}

class BeatFactorSystem extends VoidEntitySystem {
  double beatFactor = 1.0;
  double maxBeat = 5.0;
  List<int> byteFrequencyData;

  BeatFactorSystem(this.byteFrequencyData);

  @override
  void processSystem() {
    beatFactor = byteFrequencyData.reduce(sum) / byteFrequencyData.length;
    maxBeat = max(maxBeat, beatFactor);
    beatFactor = 1.0 + 50 * beatFactor / maxBeat;
  }

  int sum(int a, int b) => a + b;
}

class StickyBlockPositionUpdatingSystem extends EntityProcessingSystem {
  Mapper<StickyBlock> sbm;
  Mapper<Position> pm;
  GridManager gm;

  StickyBlockPositionUpdatingSystem() : super(Aspect.getAspectForAllOf([Position, StickyBlock]));

  @override
  void processEntity(Entity entity) {
    var p = pm[entity];
    var sb = sbm[entity];

    p.x = p.x * 0.8 + gm.getColPos(sb.col) * 0.2;
    p.y = p.y * 0.8 + (-0.475 + sb.row * -0.2 * gm.posFactor - 0.02 * gm.sizeFactor * (sb.row + 1)) * 0.2;
  }
{'fraction_non_alphanumeric': 0.1275531471446436, 'fraction_numerical': 0.012505210504376824, 'mean_word_length': 3.7846460618145565, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 25, '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': '4491996', 'n_tokens_mistral': 1689, 'n_tokens_neox': 1590, 'n_words': 331}