Update icons, fix recalculation of graph
This commit is contained in:
parent
431b414b35
commit
1d825f4ca5
@ -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): #кол-во линий
|
||||
|
||||
@ -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:
|
||||
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
|
||||
|
||||
BIN
ui/graph.png
BIN
ui/graph.png
Binary file not shown.
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 9.9 KiB |
BIN
ui/icon.png
BIN
ui/icon.png
Binary file not shown.
|
Before Width: | Height: | Size: 9.9 KiB After Width: | Height: | Size: 14 KiB |
Loading…
x
Reference in New Issue
Block a user