GIT :/
parent
8af3252278
commit
4e40be8d72
|
@ -4,8 +4,13 @@ CMakeLists.txt
|
|||
*kevin*
|
||||
*.out
|
||||
/venv/*
|
||||
/venv3/*
|
||||
*.zip
|
||||
/jasmin-2.4/*
|
||||
hash.txt
|
||||
/drm/target/*
|
||||
/drm/Cargo.lock
|
||||
/drm/Cargo.lock
|
||||
/DeepNested/target/*
|
||||
pi.txt
|
||||
/DeepNested/src/main/java/net/ahines/DeepNested/*
|
||||
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4" />
|
|
@ -0,0 +1,38 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>net.ahines</groupId>
|
||||
<artifactId>DeepNested</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<developers>
|
||||
<developer>
|
||||
<name>ZeroHD</name>
|
||||
<url>https://www.ahines.net</url>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
<build>
|
||||
<defaultGoal>install</defaultGoal>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<!-- Build an executable JAR -->
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.4</version>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>net.ahines.DeepNested.DeepNested</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
15
Makefile
15
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
|
||||
|
|
|
@ -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("}")
|
Loading…
Reference in New Issue