summaryrefslogtreecommitdiff
path: root/tools/genconst.js
diff options
context:
space:
mode:
Diffstat (limited to 'tools/genconst.js')
-rw-r--r--tools/genconst.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/tools/genconst.js b/tools/genconst.js
new file mode 100644
index 0000000..a2b9235
--- /dev/null
+++ b/tools/genconst.js
@@ -0,0 +1,25 @@
+const data = require("../data.js")
+
+function clean_name(s) {
+ return s.toUpperCase()
+ .replace(" - ", "_")
+ .replace(/[ /-]/g, "_")
+ .replace(/[!,*"'.]/g, "")
+}
+
+console.log("")
+
+console.log("// SPACES")
+for (let s of data.spaces) {
+ console.log("const S_" + clean_name(s.ascii_name) + " = " + s.space_id)
+}
+
+console.log("")
+
+console.log("// CARDS")
+for (let c of data.cards) {
+ if (c)
+ console.log("const C_" + clean_name(c.name) + " = " + c.number)
+}
+
+console.log("")