Skip to content

Commit cefdcd3

Browse files
committed
add values to svg output
1 parent 54f79a2 commit cefdcd3

File tree

5 files changed

+6
-3
lines changed

5 files changed

+6
-3
lines changed
0 Bytes
Binary file not shown.

__pycache__/grid.cpython-36.pyc

72 Bytes
Binary file not shown.

djikstra.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
from distance_grid import DistanceGrid
22
from binary_tree import BinaryTree
33

4-
grid = DistanceGrid(5,5)
4+
grid = DistanceGrid(12,12)
55
BinaryTree.mutate(grid)
66

7-
start = grid.grid[0][0]
7+
start = grid.grid[0][11]
88
distances = start.distances()
99

1010
grid.distances = distances
1111

1212
grid.to_string()
13+
grid.to_grid()

grid.py

+2
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ def to_grid(self, cell_size = 20):
8181
y1 = cell.row * cell_size + left_offset
8282
x2 = (cell.column + 1) * cell_size + top_offset
8383
y2 = (cell.row + 1) * cell_size + left_offset
84+
dwg.add(dwg.text(self.contents_of(cell), insert=(x1 + 5 ,y1 + cell_size - 5)))
85+
8486

8587
if not cell.north:
8688
dwg.add(dwg.line((x1, y1), (x2, y1), stroke=svgwrite.rgb(10, 10, 16, '%')))

maze.svg

+1-1
Loading

0 commit comments

Comments
 (0)