Skip to content

Instantly share code, notes, and snippets.

@mistercam
Created April 29, 2012 18:53
Show Gist options
  • Save mistercam/2552638 to your computer and use it in GitHub Desktop.
Save mistercam/2552638 to your computer and use it in GitHub Desktop.
A Reversi sketch
(defn setup []
"Configures the properties of our sketch."
(smooth) ; turns on anti-aliasing
(frame-rate fps) ; the number of times per second we'll redraw the board
(apply background color-black)) ; sets the background
(defn reversi-quil []
"Starts a quil-based Reversi game."
(let [board (atom (initialize-board))
piece (atom :b )
game-over (atom false)
msg (atom [0 nil])]
(defsketch reversi ; Define a new Reversi sketch
:title "Reversi"
:setup setup ; specifies the function used to initializes the sketch
:draw (partial draw-board board piece msg) ; specifies the draw function
:mouse-clicked (partial mouse-clicked board piece game-over msg) ; specifies the mouse clicked handler
:size [board-size (+ board-size footer-height)]))) ; specifies the size of the sketch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment