Skip to content

Instantly share code, notes, and snippets.

View lucas-mancini's full-sized avatar

Lucas lucas-mancini

View GitHub Profile

Keybase proof

I hereby claim:

  • I am lucas-mancini on github.
  • I am lucasmancini (https://keybase.io/lucasmancini) on keybase.
  • I have a public key ASBGSAYrYOYh2FgpG-m007-rCFVBi3RN2pbDs-ybk7rXqwo

To claim this, I am signing this object:

@lucas-mancini
lucas-mancini / queens.clj
Created April 21, 2017 19:04
Program that solves the N queens puzzle in Clojure
(ns queens.core
(:gen-class))
; Program that finds solutions for the N queens problem.
; A solution always exists when N >= 4.
; see: https://en.wikipedia.org/wiki/Eight_queens_puzzle
; Notice this is a very basic algorithm and it can be improved
(defn threat
"Check if queen on row q threatens queen on row r on board."