Skip to content

Instantly share code, notes, and snippets.

(in-package :cl-user)
;; http://theinfosphere.org/The_Prisoner_of_Benda
;; BODY | MIND
;; -------------------------
;; farnsworth | leela
;; amy | washbucket
;; bender | farnsworth
(defn exchange-presents
"Run around the elves in a circle starting at the middle and drop-drop-skip
until there is only one elf left."
[n]
(let [elves (vec (range 1 (inc n)))
mid (int (/ (count elves) 2))
actions (if (even? (count elves))
[:drop :drop :skip]
[:drop :skip :drop])]
(loop [elves elves
@anthonyf
anthonyf / gist:3380894
Created August 17, 2012 17:38
Triazzle puzzle solver in Emacs Lisp
;; -*- lexical-binding: t -*-
(require 'cl)
;; piece configuration
;; /\
;; / \
;; /B y\
;; / 0 \
;; /___F____\