3 # Compose each piece SVG with numbers
4 # https://travishorn.com/removing-parts-of-shapes-in-svg-b539a89e5649
5 # https://developer.mozilla.org/fr/docs/Web/SVG/Tutoriel/Paths
7 preamble
= """<?xml version="1.0" encoding="UTF-8" ?>
8 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
9 <svg xmlns="http://www.w3.org/2000/svg" version="1.0" width="230" height="230">"""
11 black
= '<circle cx="115" cy="115" r="100" fill="red" stroke="darkslategray"/>'
12 white
= '<circle cx="115" cy="115" r="100" fill="yellow" stroke="darkslategray"/>'
16 '<path d="M125,95 v40"',
18 '<path d="M105,95 h20 v20 h-20 v20 h20"',
20 '<path d="M105,95 h20 v20 h-20 M125,115 v20 h-20"',
22 '<path d="M105,95 v20 h20 v20 M125,95 v20"',
24 '<path d="M125,95 h-20 v20 h20 v20 h-20"'
29 for color
in ["white", "black"]:
30 for number
in range(5):
31 filename
= ('w' if color
== "white" else 'b') + chr(97 + number
+ 1) + ".svg"
32 f
= open(filename
, "w")
35 f
.write(white
if color
== "white" else black
)
37 f
.write(digits
[number
] + ' fill="none" stroke-width="4" ' + ('stroke="red"' if color
== "white" else 'stroke="yellow"') + '/>')