diff --git a/.gitignore b/.gitignore index a175aa8..bc98862 100644 --- a/.gitignore +++ b/.gitignore @@ -4,8 +4,13 @@ CMakeLists.txt *kevin* *.out /venv/* +/venv3/* *.zip /jasmin-2.4/* hash.txt /drm/target/* -/drm/Cargo.lock \ No newline at end of file +/drm/Cargo.lock +/DeepNested/target/* +pi.txt +/DeepNested/src/main/java/net/ahines/DeepNested/* + diff --git a/DeepNested/DeepNested.iml b/DeepNested/DeepNested.iml new file mode 100644 index 0000000..78b2cc5 --- /dev/null +++ b/DeepNested/DeepNested.iml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/DeepNested/pom.xml b/DeepNested/pom.xml new file mode 100644 index 0000000..3238c23 --- /dev/null +++ b/DeepNested/pom.xml @@ -0,0 +1,38 @@ + + + 4.0.0 + + net.ahines + DeepNested + 1.0-SNAPSHOT + jar + + + + ZeroHD + https://www.ahines.net + + + + + install + + + + org.apache.maven.plugins + maven-jar-plugin + 2.4 + + + + net.ahines.DeepNested.DeepNested + + + + + + + + \ No newline at end of file diff --git a/Makefile b/Makefile index 3edec04..5747b9a 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,24 @@ CC = gcc FLAGS = -m32 -nostdlib -nostdinc -static -Wall -O2 -clean: hash +clean: hash pi @echo $(step_count) ${CC} ${FLAGS} main.c -o 0.out -remove: +remove: clean_pi echo "#define output" > hash.txt rm *.out hash: ./jasmin.sh + +clean_pi: + rm -rf DeepNested/target + rm DeepNested/src/main/java/net/ahines/DeepNested/DeepNested.java + rm pi.txt + + +pi: + python3 nester.py > DeepNested/src/main/java/net/ahines/DeepNested/DeepNested.java + mvn -f DeepNested/pom.xml + java -jar DeepNested/target/DeepNested-1.0-SNAPSHOT.jar > pi.txt diff --git a/nester.py b/nester.py new file mode 100644 index 0000000..e275eb4 --- /dev/null +++ b/nester.py @@ -0,0 +1,36 @@ +limit = 25 +print("package net.ahines.DeepNested;") +print("class DeepNested {") +print("\tpublic static void main(String args[]) {") +print("\t\tNested1 nested1 = new Nested1(0.0);") +print("\t}") + +class_name = "Nested%d" +class_header = "public static class %s {" + +for i in range(1, limit): + tab_str = "\t" + for x in range(0, i): + tab_str += "\t" + + nested_name = class_name % i + nested_header = class_header % nested_name + print(tab_str + nested_header) + print(tab_str + "\t" + nested_name + "(double sum) {") + print(tab_str + "\t\t" + ("sum += ((-1)^(%d+1)) / (2.0 * %d - 1.0);" % (i, i))) # copied from stack overflow + + if (i == limit-1): + print(tab_str + "\t\tSystem.out.println(sum);") + else: + print(tab_str + "\t\tNested%d test%d = new %s(sum);" % (i+1, i, class_name % (i+1))) + print(tab_str + "}") + print("\n") + +for i in range(limit, 1, -1): + tab_str = "" + for x in range(0, i): + tab_str += "\t" + + print(tab_str + "}") + +print("}")