746a2be61781f51847901c3d2bc4bb531031c1c8
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="crimson" stroke="darkslategray"/>'
12 white
= '<circle cx="115" cy="115" r="100" fill="gold" stroke="darkslategray"/>'
16 '<path d="M130,85 v60"',
18 '<path d="M100,85 h30 v30 h-30 v30 h30"',
20 '<path d="M100,85 h30 v30 h-30 M130,115 v30 h-30"',
22 '<path d="M100,85 v30 h30 v30 M130,85 v30"',
24 '<path d="M130,85 h-30 v30 h30 v30 h-30"'
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
)
38 f
.write(digits
[number
] + ' fill="none" stroke-width="5" ' + ('stroke="red"' if color
== "white" else 'stroke="yellow"') + '/>')