A clojure version of the Chain Reaction Android game.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src/chainreact_clj
.gitignore
LICENSE
README.md
project.clj

README.md

chainreact-clj

A clojure version of the Chain Reaction Android game.

I built a version of the game on Javascript that is at http://madhuvishy.in/ChainReaction.html and the code is here: https://gist.github.com/madhuvishy/7711874. This is an attempt to build a Clojure version of the same game to see how the design of the game changes in the functional programming sense.

To play the game, clone the repo, and run:

lein run <board-size> <number-of-players>

To play enter "row column" where the move is made (Yes, not sweet, but building UI's with Swing is not sweet either)

Example:

chainreact-clj [master] lein run 8 2
(("++  " "+++ " "+++ " "+++ " "+++ " "+++ " "+++ " "++  ")
 ("+++ " "++++" "++++" "++++" "++++" "++++" "++++" "+++ ")
 ("+++ " "++++" "++++" "++++" "++++" "++++" "++++" "+++ ")
 ("+++ " "++++" "++++" "++++" "++++" "++++" "++++" "+++ ")
 ("+++ " "++++" "++++" "++++" "++++" "++++" "++++" "+++ ")
 ("+++ " "++++" "++++" "++++" "++++" "++++" "++++" "+++ ")
 ("+++ " "++++" "++++" "++++" "++++" "++++" "++++" "+++ ")
 ("++  " "+++ " "+++ " "+++ " "+++ " "+++ " "+++ " "++  "))
Player 0's turn
0 0
(("0_  " "+++ " "+++ " "+++ " "+++ " "+++ " "+++ " "++  ")
 ("+++ " "++++" "++++" "++++" "++++" "++++" "++++" "+++ ")
 ("+++ " "++++" "++++" "++++" "++++" "++++" "++++" "+++ ")
 ("+++ " "++++" "++++" "++++" "++++" "++++" "++++" "+++ ")
 ("+++ " "++++" "++++" "++++" "++++" "++++" "++++" "+++ ")
 ("+++ " "++++" "++++" "++++" "++++" "++++" "++++" "+++ ")
 ("+++ " "++++" "++++" "++++" "++++" "++++" "++++" "+++ ")
 ("++  " "+++ " "+++ " "+++ " "+++ " "+++ " "+++ " "++  "))
Player 1's turn
0 1
(("0_  " "1__ " "+++ " "+++ " "+++ " "+++ " "+++ " "++  ")
 ("+++ " "++++" "++++" "++++" "++++" "++++" "++++" "+++ ")
 ("+++ " "++++" "++++" "++++" "++++" "++++" "++++" "+++ ")
 ("+++ " "++++" "++++" "++++" "++++" "++++" "++++" "+++ ")
 ("+++ " "++++" "++++" "++++" "++++" "++++" "++++" "+++ ")
 ("+++ " "++++" "++++" "++++" "++++" "++++" "++++" "+++ ")
 ("+++ " "++++" "++++" "++++" "++++" "++++" "++++" "+++ ")
 ("++  " "+++ " "+++ " "+++ " "+++ " "+++ " "+++ " "++  "))
Player 0's turn
0 2
(("0_  " "1__ " "0__ " "+++ " "+++ " "+++ " "+++ " "++  ")
 ("+++ " "++++" "++++" "++++" "++++" "++++" "++++" "+++ ")
 ("+++ " "++++" "++++" "++++" "++++" "++++" "++++" "+++ ")
 ("+++ " "++++" "++++" "++++" "++++" "++++" "++++" "+++ ")
 ("+++ " "++++" "++++" "++++" "++++" "++++" "++++" "+++ ")
 ("+++ " "++++" "++++" "++++" "++++" "++++" "++++" "+++ ")
 ("+++ " "++++" "++++" "++++" "++++" "++++" "++++" "+++ ")
 ("++  " "+++ " "+++ " "+++ " "+++ " "+++ " "+++ " "++  "))
Player 1's turn
0 1
(("0_  " "11_ " "0__ " "+++ " "+++ " "+++ " "+++ " "++  ")
 ("+++ " "++++" "++++" "++++" "++++" "++++" "++++" "+++ ")
 ("+++ " "++++" "++++" "++++" "++++" "++++" "++++" "+++ ")
 ("+++ " "++++" "++++" "++++" "++++" "++++" "++++" "+++ ")
 ("+++ " "++++" "++++" "++++" "++++" "++++" "++++" "+++ ")
 ("+++ " "++++" "++++" "++++" "++++" "++++" "++++" "+++ ")
 ("+++ " "++++" "++++" "++++" "++++" "++++" "++++" "+++ ")
 ("++  " "+++ " "+++ " "+++ " "+++ " "+++ " "+++ " "++  "))
Player 0's turn
0 0
(("0_  " "+++ " "00_ " "+++ " "+++ " "+++ " "+++ " "++  ")
 ("0__ " "0___" "++++" "++++" "++++" "++++" "++++" "+++ ")
 ("+++ " "++++" "++++" "++++" "++++" "++++" "++++" "+++ ")
 ("+++ " "++++" "++++" "++++" "++++" "++++" "++++" "+++ ")
 ("+++ " "++++" "++++" "++++" "++++" "++++" "++++" "+++ ")
 ("+++ " "++++" "++++" "++++" "++++" "++++" "++++" "+++ ")
 ("+++ " "++++" "++++" "++++" "++++" "++++" "++++" "+++ ")
 ("++  " "+++ " "+++ " "+++ " "+++ " "+++ " "+++ " "++  "))
Player 1's turn
Player 0 WON