Example #1
0
def main():
    if len(sys.argv) < 2:
        terminate_with_usage()

    n_particles = parse_number(sys.argv[1])
    if n_particles <= 0:
        terminate_with_usage()

    try:
        particle_system = ParticleSystem(n_particles)
        particle_system.loop()
    except IOError as e:
        print(Style.BRIGHT + Fore.RED + 'I/O Error: ' + Style.RESET_ALL +
              Fore.RESET + str(e))
    except ParticleSystemException as e:
        print(Style.BRIGHT + Fore.RED + 'ParticleSystemException: ' +
              Style.RESET_ALL + Fore.RESET + str(e))