Draw the Solution
00:39 You transform the squares of the solution to get their corresponding pixel coordinates. Notice that you add an extra offset to center the solution’s line vertically and horizontally in each square,
marker-end SVG attribute refers to the SVG object identified as
#arrow, which you defined earlier. At this point, you can print the resulting SVG in the console or save its XML content to a local file. You’ll make use of the maze you saved earlier in the course here, so ensure that your REPL session starts at the same level as the
pyproject.toml file to ensure that the relative import of the
mini_maze works correctly.
First, you import the
mini_maze, which was created earlier, and then
pathlib to make creation of the file smpler. The
SVGRenderer are imported from the
maze_solver project …
02:41 You should see something similar to what’s seen on-screen, but bear in mind that the rendering will look different depending on how you open it. On-screen, you can see the difference when opening in Firefox and Inkscape, and which one you prefer will be personal choice.
Become a Member to join the conversation.