Generate random input

This commit is contained in:
George Lacey 2017-02-15 12:48:22 +00:00
parent b607814e0f
commit 80b2afed59

20
Main.py
View File

@ -27,7 +27,7 @@ def line_perceptron():
def calc_y(p_x): def calc_y(p_x):
return p_x + 100 return p_x + 100
for ind in range(0, 100): for ind in range(0, 1000):
x = rand.randint(-1000, 1000) x = rand.randint(-1000, 1000)
y = rand.randint(-1000, 1000) y = rand.randint(-1000, 1000)
print(x, y) print(x, y)
@ -47,15 +47,15 @@ def line_perceptron():
graph.drawCircle(Point(x, y), 4, "red")''' graph.drawCircle(Point(x, y), 4, "red")'''
for i in range(0, 1000000): for i in range(0, 1000000):
x = int(input()) x = rand.randint(-320, 320)
y = int(input()) y = rand.randint(-240, 240)
if i == 500: p.input(x, y)
y = 8 if p.activation() == 1:
p.input(x, y) graph.drawCircle(Point(x, y), 4, "green")
if p.activation() == 1: else:
graph.drawCircle(Point(x, y), 4, "green") graph.drawCircle(Point(x, y), 4, "red")
else: if i % 1000 == 0:
graph.drawCircle(Point(x, y), 4, "red") graph.drawLine(Point(-1000, -1000 + 100), Point(1000, 1000 + 100))
input() input()