diff --git a/src/main/java/com/vectron/fcl/Dictionary.java b/src/main/java/com/vectron/fcl/Dictionary.java index d52e91c..f893192 100644 --- a/src/main/java/com/vectron/fcl/Dictionary.java +++ b/src/main/java/com/vectron/fcl/Dictionary.java @@ -29,9 +29,9 @@ public class Dictionary { } public void remove(String name) { - Word exiting = at(name); - if (exiting != null) - dict.remove(exiting); + Word existing = at(name); + if (existing != null) + dict.remove(existing); } public Set wordList() { diff --git a/src/main/java/com/vectron/fcl/Juggler.java b/src/main/java/com/vectron/fcl/Juggler.java index 0a40b5b..2670b5a 100644 --- a/src/main/java/com/vectron/fcl/Juggler.java +++ b/src/main/java/com/vectron/fcl/Juggler.java @@ -68,6 +68,7 @@ public class Juggler { this.rstack = new Stack<>(); this.code = new ArrayList<>(); this.availableWords = populateWords(excluded); + this.code.add(0); } private List populateWords(Set excluded) { @@ -82,10 +83,6 @@ public class Juggler { private List solve() { if (input.isEmpty() && output.isEmpty() || input.equals(output)) return Collections.emptyList(); - - code.clear(); - code.add(0); - while (code.size() <= maxSteps) { if (goodCode(code)) return result(code);