summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
author0scar <qgt268@alumni.ku.dk>2020-09-29 06:51:02 +0000
committer0scar <qgt268@alumni.ku.dk>2023-07-28 09:48:17 +0000
commit6c16f339224a4736f4ed57d15bb3e5f968a635ab (patch)
treeab13afea4b6f9acfb4a139a3125f265c90bc9d80 /tools
Initial independent commit
Diffstat (limited to 'tools')
-rwxr-xr-xtools/scripts/lint28
-rw-r--r--tools/scripts/scaling.py27
2 files changed, 55 insertions, 0 deletions
diff --git a/tools/scripts/lint b/tools/scripts/lint
new file mode 100755
index 0000000..0c0c352
--- /dev/null
+++ b/tools/scripts/lint
@@ -0,0 +1,28 @@
+#!/usr/bin/env sh
+
+SRCDIR="${SRCDIR:-src}"
+
+echo "Running bear..."
+if which bear >/dev/null ; then
+ make clean
+ bear -- make 2>&1>/dev/null
+else
+ echo -e "\e[31mnot found. Without compile_commands.json results might be bad or outright wrong.\e[0m"
+fi
+
+echo "Running cppcheck..."
+if which cppcheck >/dev/null ; then
+ echo ""
+ if [ -e 'compile_commands.json' ] ; then
+ cppcheck --language=c --std=c99 --enable=all \
+ --suppress={missingIncludeSystem,unusedFunction} \
+ --project=compile_commands.json \
+ -q "${SRCDIR}"
+ else
+ cppcheck --language=c --std=c99 --enable=all \
+ --suppress={missingIncludeSystem,unusedFunction} \
+ -q "${SRCDIR}"
+ fi
+else
+ echo -e "\e[31mnot found\e[0m"
+fi
diff --git a/tools/scripts/scaling.py b/tools/scripts/scaling.py
new file mode 100644
index 0000000..a60da46
--- /dev/null
+++ b/tools/scripts/scaling.py
@@ -0,0 +1,27 @@
+import numpy as np
+import matplotlib.pyplot as plt
+
+fig = plt.figure()
+
+def f(x):
+ # experience to level
+ #return (np.log(x/4+1)**2) / 4 + 1
+ # Difficulty scaling
+ return 1 + (2**(np.log(1 + x)) + np.floor(x / 5) / 2) * 100
+ # Light level
+ #return np.log(1+x) / np.log(2) * (4*log(2)/log(3))
+
+x = np.arange(25)
+y = [f(i)/15 for i in x]
+
+
+cutoff = len([v for v in y if v >= 0])
+#
+#
+plt.grid(visible=True, which='major', axis='both')
+plt.plot(x[:cutoff], y[:cutoff])
+
+plt.show()
+
+for v in zip(x,y):
+ print('{}:{:.2f}'.format(v[0], v[1]))