Skip to content

Instantly share code, notes, and snippets.

View msgodf's full-sized avatar

Mark Godfrey msgodf

View GitHub Profile
@msgodf
msgodf / bots.clj
Last active December 19, 2015 00:19 — forked from cgrand/bots.clj
Tron bot, function is msgodf-random-indecisive
(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
(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 07:32 — forked from tcoupland/dijkstra-core.clj
Brisfunctional dojo code implementing dijkstra's algorithm 29-05-2012
(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 07:28 — forked from mjg123/dijkstra-core.clj
Brisfunctional dojo code implementing dijkstra's algorithm 29-05-2012
(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]