From ab84e7d192fb684316dff689e9ce75a937143dd4 Mon Sep 17 00:00:00 2001 From: Benjamin Auder Date: Wed, 13 May 2026 14:49:35 +0200 Subject: [PATCH] update --- initialize.sh | 2 +- pieces/Emergo/generateSVG_composite.py | 98 ++++++++++++++++ pieces/Emergo/generateSVG_simple.py | 150 +++++++++++++++++++++++++ 3 files changed, 249 insertions(+), 1 deletion(-) create mode 100755 pieces/Emergo/generateSVG_composite.py create mode 100755 pieces/Emergo/generateSVG_simple.py diff --git a/initialize.sh b/initialize.sh index 9e187d0..a7fd40d 100755 --- a/initialize.sh +++ b/initialize.sh @@ -5,4 +5,4 @@ wget https://xogo.casa/extras.zip && unzip extras.zip cp js/parameters.js.dist js/parameters.js npm i cd pieces/Avalam && python generateSVG.py && cd ../.. -#cd pieces/Emergo && python generateSVG.py && cd ../.. +cd pieces/Emergo && python generateSVG.py && cd ../.. diff --git a/pieces/Emergo/generateSVG_composite.py b/pieces/Emergo/generateSVG_composite.py new file mode 100755 index 0000000..85726d5 --- /dev/null +++ b/pieces/Emergo/generateSVG_composite.py @@ -0,0 +1,98 @@ +#!/usr/bin/env python + +# Compose each piece SVG with numbers +# https://travishorn.com/removing-parts-of-shapes-in-svg-b539a89e5649 +# https://developer.mozilla.org/fr/docs/Web/SVG/Tutoriel/Paths + +preamble = """ + + + + + + + +""" + +black_top = '' +white_bottom = '' +white_top = '' +black_bottom = '' + +digits = { + "top": [ + # 1 (unused here) + '= 1: + f.write(digits["top"][top] + ' fill="none" stroke-width="5" ' + ('stroke="red"' if colorTop == "white" else 'stroke="orange"') + '/>') + f.write("\n") + if bottom >= 1: + f.write(digits["bottom"][bottom] + ' fill="none" stroke-width="5" ' + ('stroke="red"' if colorTop == "black" else 'stroke="orange"') + '/>') + f.write("\n") + f.write(final) + f.close() diff --git a/pieces/Emergo/generateSVG_simple.py b/pieces/Emergo/generateSVG_simple.py new file mode 100755 index 0000000..51f734e --- /dev/null +++ b/pieces/Emergo/generateSVG_simple.py @@ -0,0 +1,150 @@ +#!/usr/bin/env python + +# Compose each piece SVG with numbers +# https://travishorn.com/removing-parts-of-shapes-in-svg-b539a89e5649 +# https://developer.mozilla.org/fr/docs/Web/SVG/Tutoriel/Paths + +preamble = """ + +""" + +black = '' +white = '' + +digits = [ + # 1 (unused) + '= 1: + f.write(digits[number] + ' fill="none" stroke-width="5" ' + ('stroke="red"' if color == "white" else 'stroke="orange"') + '/>') + f.write("\n") + f.write(final) + f.close() + + +preamble = """ + + + + + + + +""" + +black_top = '' +white_bottom = '' +white_top = '' +black_bottom = '' + +digits = { + "top": [ + # 1 (unused here) + '= 1: + f.write(digits["top"][top] + ' fill="none" stroke-width="5" ' + ('stroke="red"' if colorTop == "white" else 'stroke="orange"') + '/>') + f.write("\n") + if bottom >= 1: + f.write(digits["bottom"][bottom] + ' fill="none" stroke-width="5" ' + ('stroke="red"' if colorTop == "black" else 'stroke="orange"') + '/>') + f.write("\n") + f.write(final) + f.close() -- 2.53.0