Skip to content

Commit

Permalink
Fix use of crosscram.game/available-moves in several bots.
Browse files Browse the repository at this point in the history
  • Loading branch information
timmc committed Sep 30, 2012
1 parent 8b0d8ca commit 2bc8339
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/crosscram/game.clj
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ perspective. (Unary form defaults to 1.) Player ID will be used modulo 2."
"Generate a lazy seq of all possible horizontal moves. To get opponent
moves, rotate the board first."
[board]
{:pre [(vector? board)]}
(for [[r row] (map-indexed vector board)
found (keep-indexed (fn [c pair] (when (= [nil nil] pair)
[[r c] [r (inc c)]]))
Expand Down
5 changes: 3 additions & 2 deletions src/crosscram/samples/reserves_move.clj
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,6 @@
(or (above-saves? game move)
(below-saves? game move)))
(defn make-move [game]
(or (first (filter (partial reserves-move? game) (game/available-moves game)))
(first (game/available-moves game))))
(or (first (filter (partial reserves-move? game)
(game/available-moves (:board game))))
(first (game/available-moves (:board game)))))
2 changes: 1 addition & 1 deletion src/crosscram/samples/windowshade_rand.clj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ remaining rows."
(def separate (juxt filter remove))

(defn make-move [game]
(let [all (game/available-moves game)
(let [all (game/available-moves (:board game))
[e_ o_] (separate (comp even? ffirst) all)
[ee eo] (separate #(even? (second (first %))) e_)
[oe oo] (separate #(even? (second (first %))) o_)]
Expand Down

0 comments on commit 2bc8339

Please sign in to comment.