Пример #1
0
def main(argv):
    assert len(argv) == 2, "Vous devez donner le nombre de points"
    points = int(argv[1])
    assert points > 0, "Le nombre de points doit être > 0"

    delta = time.perf_counter()
    m = Matrix()
    m.fill_matrix(points)
    delta = time.perf_counter() - delta
    perf_stats(m.approx_pi(), points, delta)
Пример #2
0
def main(argv):
    width = int(argv[1])
    points = int(argv[2])
    rounding = int(argv[3])

    m = Matrix(width)
    steps = points // 10

    delta = time.perf_counter()

    fnames = []
    for n, p in enumerate(range(steps, points + steps, steps)):
        m.fill_matrix(steps)
        fname = generate_ppm_file(m, rounding, n)
        fnames.append(fname)

    print("Generating GIF pi.gif")
    subprocess.call(["python", "convert.py"] + fnames + ["pi.gif"])

    delta = time.perf_counter() - delta
    perf_stats(m.approx_pi(), points, delta)