This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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] |