From 80b2afed598ecf6dc1961765a44cd028c645f7d5 Mon Sep 17 00:00:00 2001 From: George Lacey Date: Wed, 15 Feb 2017 12:48:22 +0000 Subject: [PATCH] Generate random input --- Main.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Main.py b/Main.py index 68dabca..fe13f96 100644 --- a/Main.py +++ b/Main.py @@ -27,7 +27,7 @@ def line_perceptron(): def calc_y(p_x): return p_x + 100 - for ind in range(0, 100): + for ind in range(0, 1000): x = rand.randint(-1000, 1000) y = rand.randint(-1000, 1000) print(x, y) @@ -47,15 +47,15 @@ def line_perceptron(): graph.drawCircle(Point(x, y), 4, "red")''' for i in range(0, 1000000): - x = int(input()) - y = int(input()) - if i == 500: - y = 8 - p.input(x, y) - if p.activation() == 1: - graph.drawCircle(Point(x, y), 4, "green") - else: - graph.drawCircle(Point(x, y), 4, "red") + x = rand.randint(-320, 320) + y = rand.randint(-240, 240) + p.input(x, y) + if p.activation() == 1: + graph.drawCircle(Point(x, y), 4, "green") + else: + graph.drawCircle(Point(x, y), 4, "red") + if i % 1000 == 0: + graph.drawLine(Point(-1000, -1000 + 100), Point(1000, 1000 + 100)) input()