Update icons, fix recalculation of graph

This commit is contained in:
anqude 2023-03-02 22:18:51 +04:00 committed by GitHub
parent 431b414b35
commit 1d825f4ca5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 18 deletions

View File

@ -193,10 +193,7 @@ def gena():
resx,resy=400,400
canvas = Canvas(root,background=bg_color,highlightbackground=bg_color)
canvas.pack(fill="both", expand=True)
while True:
a=ggraph(n, xn, yn)
if a!=None:
break
a=ggraph(n, xn, yn)
Xcoordinates,Ycoordinates,Xnull_coordinates,Ynull_coordinates=anonim(n,xn,yn,a,resx,resy)
def draw(n,xn,yn,Xcoordinates,Ycoordinates,Xnull_coordinates,Ynull_coordinates):
for i in range (xn): #кол-во линий

View File

@ -1,10 +1,6 @@
import random,time
import random
def graph(x,y): #Создаём двумерный массив, заполненный гулями
a = []
for i in range(y):
a.append([])
for j in range(x):
a[i].append(0)
a = [[0] * x for _ in range(y)]
return a
def ggraph(n,xn,yn):
@ -12,8 +8,7 @@ def ggraph(n,xn,yn):
b = graph(xn, yn)
x0 = 0
y0 = 0
from time import time
timing = time()
iteration=0
while m < n+1:
x = random.randint(0, xn-1)
y = random.randint(0, yn-1)
@ -23,16 +18,15 @@ def ggraph(n,xn,yn):
y0 = y
m += 1
if time() - timing > 0.06:
b = None
break
else:
else:
iteration+=1
if iteration>xn*yn*n:
h=ggraph(n,xn,yn)
return h
continue
return b
def find(matrix, value):
value_indexs = [ ( matrix.index(row), row.index(value) ) for row in matrix if value in row]
return value_indexs

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.9 KiB

After

Width:  |  Height:  |  Size: 14 KiB