[ot][spam][crazy][crazy][spam]

Karl Semich 0xloem at gmail.com
Fri Jun 17 12:15:59 PDT 2022


This is the 'triangle' thread. For some reason a new thread happened in my UI.

class Particle:
  def __init__(self, x, y, duration, xv = 0, yv = 0):
    self.x = x
    self.y = y
    self.t = duration
    self.xv = xv
    self.yv = yv
  def update(self, time):
    self.x += self.xv * time
    self.y += self.yv * time
    self.t -= duration
    return self.t >= 0

class ParticleGenerator:
  def __init__(self, rate):
    self.particles = []
    self.rate = rate
    self.time_modulus = 0
  def update(self, time):
    # i'd like to check the constant rate logic in this line
    new_particle_count, self.time_modulus = divmod(time +
self.time_modulus, self.rate)
    new_particles_made = 0
    for idx, particle in enumerate(self.particles):
      if particle is None or not particle.update(time):
        if new_particles_made < new_particle_count:
          self.particles[idx] = self.new_particle()
        else:
          self.particles[idx] = None
    while new_particles_made < new_particle_count:
      self.particles.append(self.new_particle())


More information about the cypherpunks mailing list