Skip to content

Instantly share code, notes, and snippets.

@msgodf
msgodf / bots.clj
Last active Dec 19, 2015 — forked from cgrand/bots.clj
Tron bot, function is msgodf-random-indecisive
View bots.clj
(ns tron.bots
(:require [tron.core :as tron]))
(defn empty-look
"A mock look function which just checks for the arena
boundaries."
[pos]
(when-not (tron/valid-pos? pos) :wall))
(defn mock-look
View brisfunctional-sokoban.clj
(ns sokoban.core)
(def moves {:n [0 1] :s [0 -1] :e [1 0] :w [-1 0]})
(def start-world
{:person [3 1]
:targets #{[1 3]}
:crates #{[1 2]}
:blanks #{[1 3] [2 3] [3 3]
[1 2] [2 2] [3 2]
@msgodf
msgodf / dijkstra-core.clj
Created May 30, 2012 — forked from mantree/dijkstra-core.clj
Brisfunctional dojo code implementing dijkstra's algorithm 29-05-2012
View dijkstra-core.clj
(ns dijkstra.core)
(def edges {:A {:F 14 :C 9 :B 7}
:B {:A 7 :C 10 :D 15}
:C {:A 9 :B 10 :D 11 :F 2}
:D {:B 15 :C 11 :E 6}
:E {:D 6 :F 9}
:F {:A 14 :C 2 :E 9}})
(def inf Integer/MAX_VALUE)
@msgodf
msgodf / dijkstra-core.clj
Created May 30, 2012 — forked from mjg123/dijkstra-core.clj
Brisfunctional dojo code implementing dijkstra's algorithm 29-05-2012
View dijkstra-core.clj
(ns dijkstra.core)
(def initial-node {:score Integer/MAX_VALUE :route [] :dead? false})
(defn make-initial-state [edges start-node]
(-> (zipmap (keys edges) (repeat initial-node))
(assoc-in [start-node :score] 0)
(assoc-in [start-node :route] [start-node])))
(defn live-nodes [state]