Skip to content

zzmoss/chainreact-clj

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A clojure version of the Chain Reaction Android game.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors