Passed
Push — master ( 652770...4381c0 )
by Erik
01:16
created

examples/example_004.py (9 issues)

1
from pypen import *
2
from math import sqrt
3
4
def start():
5
    settings.fps = 5
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable settings does not seem to be defined.
Loading history...
6
7
8
def update():
9
    pixel_size = 2
10
    points = []
11
    for i in range(3):
12
        points.append((random(WIDTH), random(HEIGHT)))
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable random does not seem to be defined.
Loading history...
Comprehensibility Best Practice introduced by
The variable WIDTH does not seem to be defined.
Loading history...
Comprehensibility Best Practice introduced by
The variable HEIGHT does not seem to be defined.
Loading history...
13
14
    for x, y in grid(pixel_size):
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable grid does not seem to be defined.
Loading history...
15
16
        least_dis = 1000000000000000000
17
18
        for point in points:
19
            d = sqrt((x - point[0])**2 + (y - point[1])**2)
20
            least_dis = d if d < least_dis else least_dis
21
22
        value = clamp(remap(least_dis, 0, 300, 255, 0), 0, 255)
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable remap does not seem to be defined.
Loading history...
Comprehensibility Best Practice introduced by
The variable clamp does not seem to be defined.
Loading history...
23
        color = (value, 30, 125 + 125 * sin((value**3) / 170000))
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable sin does not seem to be defined.
Loading history...
24
        rectangle(x, y, pixel_size, pixel_size, color)
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable rectangle does not seem to be defined.
Loading history...
25