Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 2 commits
  • 1 file changed
  • 0 comments
  • 1 contributor
Dec 11, 2011
hide non-api fns 1d10157
removed dup fn def from bad merge a8c124f

Showing 1 changed file with 3 additions and 10 deletions. Show diff stats Hide diff stats

  1. 13  src/aichallenge/collisions.clj
13  src/aichallenge/collisions.clj
@@ -2,7 +2,7 @@
2 2
   (:use [clojure.set :only (difference)])
3 3
   (:require [aichallenge.ant :as ant]))
4 4
 
5  
-(defn collisions [moves]
  5
+(defn- collisions [moves]
6 6
   (reduce (fn [accum move]
7 7
             (let [next-loc (apply ant/move-ant move)]
8 8
               (if (accum next-loc)
@@ -11,7 +11,7 @@
11 11
           {}
12 12
           moves))
13 13
 
14  
-(defn find-alternative [m ant dirs]
  14
+(defn- find-alternative [m ant dirs]
15 15
   (let [poss (map (fn [ant dir]
16 16
                     [ant dir (ant/move-ant ant dir)])
17 17
                   (repeat ant)
@@ -19,15 +19,8 @@
19 19
     (first (remove (fn [[_ _ next-move]] (m next-move))
20 20
                        poss))))
21 21
 
22  
-(defn all-alternatives [collisions]
23  
-  (for [collision collisions
24  
-        :let  [moves (val collision)]
25  
-        :when (> (count moves) 1)
26  
-        [ant dir] moves]
27  
-    (find-alternative collisions ant (difference directions #{dir}))))
28  
-        
29 22
 (let [directions #{:north :south :east :west}]
30  
-  (defn all-alternatives [collisions]
  23
+  (defn- all-alternatives [collisions]
31 24
     (for [collision collisions
32 25
           :let  [moves (val collision)]
33 26
           :when (> (count moves) 1)

No commit comments for this range

Something went wrong with that request. Please try again.