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
;; i freely admit that i don't holistically grok this; i just transcribed the algorithm into something slightly more clojurish | |
" | |
Algorithm: Vose's Alias Method | |
Initialization: | |
Create arrays Alias and Prob, each of size n. | |
Create two worklists, Small and Large. | |
Multiply each probability by n. |
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
Possible optional rules to make touch spells interesting. These are not written to keep combat balanced, as I don't enjoy powergaming and basically reject the core activity of D&D :| | |
* They can be kept coherent and passed between people before being deployed. Doing so taxes the caster. HP? Some other cost? | |
* This implies that they could perhaps be imbued in objects, temporarily, as traps | |
* They are somehow intimate; you're messing about in someone's aura space. You can get a bonus to the attack if you tell the target a memory of yours, which passes to them with the spell. | |
* As an unpleasant corollary, some types of curse are transmissible by touch spells | |
* Certain spell types are conducted by certain materials. Necromancy=bones? Etc etc. This could affect their deployment in certain environments. | |
* Or worse they're insulated by certain materials | |
* You can use touch un-spells to steal enchantments from other people |
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
; this isn't to throw shade at the dev; i just felt java had a lot of incidental complexity and wanted to understand what the code does | |
(defn fragmentize-chunk [chunk] | |
(set (map #(take % chunk) [1 2 3]))) | |
(defn fragmentize-word [word] | |
(->> (range (count word)) | |
(map #(drop % word)) | |
(mapcat fragmentize-chunk) | |
(map clojure.string/join))) |
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
(defn pick [doors] | |
(assoc-in doors | |
[(rand-int 3) :picked] true)) | |
(defn monty [doors] | |
(let [first-goat (first (filter | |
(comp (every-pred | |
(comp #(= :goat %) :contents) | |
(comp not :picked)) | |
#(nth doors %)) |
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
; https://gist.github.com/munificent/b1bcd969063da3e6c298be070a22b604 | |
(ns dgn) | |
(def H 40) | |
(def W 80) | |
(def TV " ") | |
(def TF ".") | |
(def TW "#") | |
(def TC "!") | |
(def TOD "\\") |
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
/*** | |
* the util file I banged together while working on a project. | |
* as a result, it's organic, not systematic. | |
* some are so trivial as not to really need defining. | |
* i think i'm used to Clojure where a lack of currying | |
* means that sometimes aliasing trivial partial functions | |
* is helpful. | |
*/ | |
/*** |
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
module Test where | |
import Html(..) | |
import Html.Attributes(..) | |
import Html.Events(..) | |
import List(..) | |
import Maybe(..) | |
import Signal(..) | |
port initialLocation : String |