Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 src
Octocat-spinner-32 README.md
Octocat-spinner-32 project.clj
README.md

Usage

Input boards like this:

(def board 
  [[:s :s :s :s :s]
   [:s :s :b :b :s]
   [:s :b :w :w :b]
   [:s :b :w :w :b]
   [:s :s :b :b :s]])

To test if a piece at a given index is alive, write e.g.

(alive? [3 3] board)

Likewise:

(dead? [3 3] board)

You can count all the "paths to life" by running

(alive-all [1 3] board)

To make (and nicely format) the first two 6X6 boards for which black is dead at [3 3], put:

(format-boards (make-boards 2 [6 6] :b dead [3 3]))

Take a look at the code for alive or dead to see core.logic in action.

Issues

Generating large boards does not work. Since you cannot create a function with more than 256 arguments, you cannot generate a board with more than 256 variables.

Something went wrong with that request. Please try again.