Zach Tellman has done a masterful job on the Penumbra library – another example of this is the Asteroids game.
You can see the code on git hub here. You can click here to launch via web start.
Zach Tellman has done a masterful job on the Penumbra library – another example of this is the Asteroids game.
You can see the code on git hub here. You can click here to launch via web start.
Posted in Clojure
U2 sang a song called ‘Stuck in a Moment’. You can ponder this as you watch this LCD timer demo by icyrock.
You can launch it via web start here. You can see the code here.
Posted in Clojure
George Orwell had lots to say on what made the perfect cup of tea. You can ponder this too whilst you watch Zach Tellerman’s Clojure 3D teapot demo.
Click this link to launch. You can view the source code here.
Posted in Clojure
Get creature URLs here.
Alex Miller created a Clojure demo of Game of Life.
Dave Ray ported it to his Seesaw Clojure Swing library.
You can start it via webstart here. The code is available on github here.
Posted in Clojure
Did you know that ferns are fractal in nature? You can represent them using a recursive algorithm. What better way to run such an algorithm, than in Clojure on your own JVM at home:
This one was originally written by Stuart Halloway here.
You can start it via web start here. You can view the code here.
Posted in Clojure
If you’ve not heard of Black Scholes don’t fear. The equation exists in the world of Financial Services, in particular Options trading. It’s purpose is to calculate a price for a set of options given a model of a financial market containing derivative instruments.
Paul Legatohas written up a fantastic post on writing a GUI Demo for Scholes Black in Clojure.
You can start it via web start here. You can view the code here.
Posted in Clojure
Tetris is an old favourite, that I first played on a friend’s Nintendo Entertainment system. This version come to us from Alex Yakushev via Clojure.
You can play it via the following Web Start link. You can see the code on github here.
The game was originally written by Alexey Pajitnov when working for the Soviet Government. He named it after the Greek word tetra, meaning four, and his favourite game tennis.
The great thing about Alex Y’s writing style is that he puts heaps of effort into sequentially explaining what he is trying to say. You can see more of this when he talks about sockets in Clojure
Posted in Clojure
This is a Clojure demo of the game of Snake, probably best known for its inclusion on the Nokia phone, and also played on the Commodore 64.
You can start it via web start here. You can view the source code here.
This version was written by Stuart Halloway here, and included in his excellent book Programming Clojure.
Posted in Clojure
This is a Clojure demo of pong available via Java Web Start. You can see it by clicking the link here.
You can see the source code here.
This is a fork from Juan Manuel Gimeno on Github who in turn forked it from Caesar Canassa’s repository on bitbucket.
His blog post launching it is here. (It’s a fun story – couple of mates and some beers on a Saturday night get hacking, upload a demo the following day.) Top work boys!
My intention was to add Java Web start to enable it to be demoed to a wider audience and promote the clojure community.
Posted in Clojure
Has anybody looked at Applets since 1997 and Java 1.1? Why would you want to do this?
There are a couple of reasons:
Isn’t Clojurescript Cooler?
Yes – but at this point in time is less ‘production ready’ than the main Clojure release.
But haven’t people done this online already?
They have. But there is no good lifecycle for testing it in Counterclockwise (or your REPL of choice). There is no way to change the code and easily debug it, without going through a full code->compile->deploy cycle.
In Eclipse for Java Applets, you can just extend the Applet, and then right-click and select ‘run as Applet’. In Clojure (as these examples show) you can also extend the Applet. But there is no easy way to ‘Run as Applet’. Simply executing the Clojure code doesn’t start it either.
So what does the basic Applet look like?
SimpleSwingApplet.clj (ns demo.applet.SimpleSwingApplet (:import (javax.swing JApplet JPanel JLabel JFrame)) (:gen-class :post-init post-init :extends javax.swing.JApplet)) (defn -post-init [this] (def jpanel (JPanel.)) (.add jpanel (JLabel. "This is my first applet")) (.setContentPane this jpanel))
Now that’s what the other two blogs had. Great – but if you run that on your Clojure REPL, you’ll get a big fat nothing. So this is where we start adding value.
Here is what we’ll add to make it run in Counterclockwise (or your REPL of choice).
SimpleSwingAppletRunner.clj (ns game.applet.SimpleSwingAppletRunner (:import (javax.swing JApplet JPanel JLabel JFrame))) ;------ (compile 'game.applet.SimpleSwingApplet) (defn -main [s] (let [applet (new demo.applet.SimpleSwingApplet)] (doto (JFrame. "MyApplet") (.add (.getContentPane applet)) (.pack) (.setLocationByPlatform true) (.setDefaultCloseOperation JFrame/EXIT_ON_CLOSE) (.setVisible true)) )) (-main "s")
Basically we instantiate the Applet and then get the contentPane which we pass to a newly created a Frame.
Posted in Clojure