This commit is contained in:
nora 2021-04-20 15:18:54 +02:00
parent 0899a48119
commit 84f19c208c
3 changed files with 106 additions and 4 deletions

View file

@ -24,7 +24,6 @@ public class Brainfuck {
int pc = 0;
while (pc < pgm.size()) {
if (pointer > 1000) break;
switch (pgm.get(pc)) {
case '>' -> {
if (pointer == MEM_SIZE - 1) {
@ -103,8 +102,10 @@ public class Brainfuck {
String program = Files.readString(Paths.get(args[0]));
List<Character> minified = brainfuck.minify(program);
long time1 = System.currentTimeMillis();
String result = brainfuck.interpret(minified);
long time = System.currentTimeMillis() - time1;
System.out.println(result);
System.out.println("Finished execution in " + time + "ms");
}
}