Skip to content

Commit

Permalink
Various minor fixes to a couple of instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
palfrey committed Jul 5, 2012
1 parent c146fa7 commit 88b27e6
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/clostridium/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@
)

(defn rotateCCW [b] (assoc b :dir (let [[x y] (:dir b)] [(* y -1) x])))
(defn rotateCW [b] (assoc b :dir (let [[x y] (:dir b)] [y (* x -1)])))
(defn rotateCW [b] (assoc b :dir (let [[x y] (:dir b)] [y (* x -1)])))

(defn runInst [b inst]
(let [
Expand Down Expand Up @@ -326,18 +326,20 @@
\f (fn [b] (addToStack b 15))
\[ rotateCW
\] rotateCCW
\' (fn [nb] (let [b (updatePC nb true)]
(updatePC (addToStack b (int (current b))))
))
\' (fn [nb]
(let [b (updatePC nb true)]
(addToStack b (int (current b)))
)
)
\w (fn [nb]
(let [
{:keys [b items]} (removeManyFromStack nb 2)
[one two] items
]
(if (> one two)
(rotateCW b)
(if (< one two)
(rotateCCW b)
(if (< one two)
(rotateCCW b)
(if (> one two)
(rotateCW b)
b
)
)
Expand All @@ -349,8 +351,8 @@
[x y] items
]
(do
(println "Absolute delta " x " " y " " (:pc b) (:dir b))
(assoc b :dir [x y])
(println "Absolute delta:" x y (:pc b) (:dir b))
(assoc b :dir [y x])
)
)
)
Expand Down

0 comments on commit 88b27e6

Please sign in to comment.