flyingmachine/pegthing

bug in valid-moves

Opened this issue · 1 comments

There is a bug here:
https://github.com/flyingmachine/pegthing/blob/master/src/pegthing/core.clj#L98-L100

Should be:

(defn valid-moves
  "Return a map of all valid moves for pos, where the key is the
  destination and the value is the jumped position"
  [board pos]
  (into {}
        (filter (fn [[destination jumped]]
                  (and (not (pegged? board destination))
                       (pegged? board jumped)
                       (pegged? board pos)))
                (get-in board [pos :connections]))))
nando commented

Thanks Keenz!!