CELLular – A J2ME implementation of Conway’s Game of Life

August 29th, 2006

I’ve been looking for a simple way to play around with the GameCanvas – the double-buffered general purpose canvas that comes in MIDP 2.0. And being a geek^H^H^H^H person interested in esoteric things, an implementation of Conway’s Game of Life seemed like a good project.

In case you’re too lazy to click on the above link to the Wikipedia page, this is an example of Cellular Automata – a grid of “cells” that live and die according to simple rules. And interestingly, from very simple rules all kinds of ordered and complex behaviour emerges. Short summary? Its like a kind of fishtank for geeks!

CELLular (neat name, huh! You get it, right? CELLULAR automata. CELL phone. Huh? Huh? :) ) allows you to generate random grids, or to draw your own patterns, then set them in motion. And, as an added bonus, it does a nifty fade-in/fade-out effect as cells are born and die! ;)

Here’s a picture of it “in action”:

CELLular in Action

You can download CELLular here, and it should hopefully run on most MIDP2.0 devices. Enjoy!

ABC’s foray into Video podcasts

August 19th, 2006

I’m a big fan of The Chaser teams’ productions on ABC (the Australian national broadcaster), such as CNNN (sic), The Election Chaser, and most recently The Chaser’s War on Everything. For unfathomable reasons, the show gets scheduled at around 9:45pm on a Friday night, so I was pretty happy to hear that it was available via Video Podcast.

While being a big fan of standard, audio-only podcasts, I hadn’t played with Video Podcasts before. So, I updated my iTunes to the latest version, navigated to the relevant feed and clicked “subscribe”. My PC started downloading the latest episode (around 75 Mb) and shortly after, I was watching it. Better still, my PC will automatically keep an eye on the feed, and pull down the new episodes as they occur. If only I had a video iPod…ahh well, watching it on the PC monitor was fine :)

My initial reaction to all this (apart from “Yippee!”) was surprise – its not like a broadcaster to give away this stuff for free, right? Well, on reflection it makes sense. As the national broadcaster, ABC isn’t out to make cash from its products – its out to provide its material to the Australian public. Traditionally thats been done over the airwaves, but why not over the Internet?

I hope the ABC has worked out a process of integrating these download figures into their ratings numbers. And I’d be very curious to see the figures of how many people are downloading the podcast of this show – perhaps it wont be too long before this will be the new standard of broadcasting :)

How “green” is it to convert your car to LPG ?

August 9th, 2006

After reading today that the Australian Government is considering subsidising the cost of converting cars to run on LPG, I got curious about how environmentally friendly such an option is.

Turns out, its pretty good!

As background for those who haven’t heard about LPG conversions, it is possible to convert cars to run on Liquid Petroleum Gas, rather than petrol. LPG is available in most large petrol stations, and is substantially cheaper than petrol. On the downside, you do use more than standard petrol, and the conversion process typically costs between $2000 and $2500. Because of the relatively high cost of conversion, the more your drive, the more cost-effective the conversion is – Taxis, for instance, are often converted to run on LPG. Subsidising the cost of conversion, as the Government is considering, would make this attractive for people who drive shorter distances too.

The Australian National University seems to have done a feasibility study on converting their fleet to LPG. They found that using LPG resulted in between 12 to 24% less CO2 emissions over unleaded petrol. Or, to look at it another way, its like taking the car off the road 1 to 2 days a fortnight.

Thats not bad. Its worth pointing out though (as a card-carrying Prius fan!) that driving a Prius gives a 50% reduction in CO2 emissions! And cycling….well, thats better again! ;)

Java Sudoku Solver in 6 lines

July 24th, 2006

After playing around with writing Sudoku Solvers in the past, I was interested to see this page which details a number of tiny sudoku solvers in a variety of languages such as Perl, Ruby, etc.

They have a few basic rules – no line over 80 bytes, etc, etc. And the examples take their input as a string of 81 digits, which represents the 9 rows of 9 digits, with “0″ being a blank square.

As I apparently have way too much time on my hands ;) , I got up the motivation to convert one of these examples into Java. The results?

  • The end program is around twice as many lines as the Perl original, and
  • Yup – you can make Java programs as unreadable as anything else out there! ;)

There may well be shorter possibilities out there – I didn’t put in a great deal of effort past converting the Perl original. But, for the record:

import java.util.*;public class S{static char[] A;static void R(){int i,j;for(i=
0;i<81;i++){if(A[i]!='0')continue;HashMap h=new HashMap();for(j=0;j<81;j++){h.
put(j/9==i/9||j%9==i%9||(j/27==i/27)&&((j%9/3)==(i%9/3))?""+A[j]:"0","1");}for(j
=1;j<=9;j++){if(h.get(""+j)==null){A[i]=(char)('0'+j);R();}}A[i]='0';return;}for
(i=0;i<81;i++){System.out.print(A[i]);}System.out.println();System.exit(0);}
public static void main(String[] a){A=a[0].toCharArray();R();}}

Assuming you have an appropriate classpath, you can run it with a line like:

java S 006070800000000000078601520030405010400000002090302060052103690000000000003020100

This code was converted from the excellent Perl example at:

http://www.ecclestoad.co.uk/blog/2005/06/02/sudoku_solver_in_three_lines_explained.html

Prius Hacking

July 14th, 2006

Came across this link on CNN about a guy going into business selling a kit to “hack” or modify your Prius.

The kit apparently replaces the NiMh battery with a (greater capacity) Lithium Ion one, and also allows the car to be plugged in to a power point to charge it up. (For the Prius newbie’s, this is not the way they normally work – Priuses (or Priii? ;) ) charge themselves up when breaking and coasting, or by diverting power from the petrol engine).

Great idea! Some of my car-mad friends with hotted up cars have long delighted in buying modified engine management chips that squeeze more power out of the engines. This guy is modding a car to be more fuel efficient!

Obviously, some of the “green points” are lost if your house gets its electricity from a coal-powered generator plant – whenever you plug the car in to charge it up, you’re still polluting…indirectly. But if you subscribe to one of the green programs on offer, where your electricity provider sources your power from renewable sources like wind, its all good.

Interestingly, the story has Toyota being quite supportive of this kind of thing. Makes sense – as the manufacturer you want to encourage your customers to build a community around your vehicle and take it further.

Captain Planet…as you’ve never seen him before!

July 3rd, 2006

I have to admit that I never saw the original Captain Planet cartoon series – I gather it was about a superhero with a real environmental streak. Well, a friend put me onto a little video on the Net that has a whole new interpretation… :)

I should warn that its probably not for little kiddies – its only claymation animation, but some of the language is rather… earthy (pardon the pun)!

Enjoy!

Nice article on game console power consumption

June 19th, 2006

Following on from my posting on my new centameter power usage monitor, I came across this interesting article at www.dxgaming.com.

They did some testing of the power consumption of common consoles and made the discovery that the latest consoles use between 5 and 10 times more power in standby than their predecessors – so, an XBox uses 0.4W in standby, but the new XBox360 uses 2W. The Playstation and Playstation 2 is a near identical story. They have an interesting discussion about why these figures may make you switch off your Playstation 2 when not in use, but not your XBox360 – worth the read.

Recent outage resolved

June 12th, 2006

Apologies for the recent outage folks. I’ve been travelling in Europe this last month, and my ADSL modem decided to get confused 1 week into the trip. Proof that Murphy’s Law is alive and well!

On my return, a quick off/on of the ADSL modem, and everything is back online.

So, we now return you to your irregularly scheduled blog… :)

Murmurings about the next Prius

April 11th, 2006

I make it a habit to do a quick google around the net around once a week or so to see if there are any rumours about the next generation Prius. After all, its been 2 years since I bought mine – there has to be something in the works, right?

Well, stumbled across something at digg.com today on the first whispers about the next model. I’ve googled a little further, and this URL has a decent summary:

http://www.greenhybrid.com/discuss/2008-prius-lithium-ion-and-94-mpg-us.6729.html

To spoil the surprise, they’re talking about a lithium battery (instead of NiMH), fuel economy roughly twice as good (which is pretty mind-blowing itself), and shaving a second or so of the 0-100km/h figure. Nice…… :)

Only downside? The net gossip is talking about 2008 as a release date – and thats for the UK/US! Past experience has Oz getting their models another year after that. Sniff…. :(

I’ve joined the Google Analytics fan club

April 5th, 2006

After having my name on the waiting list for Google Analytics for a good 3 or 4 months, I got an email this morning inviting me to sign up. And 15 minutes later I was up and running!

Plenty has been written about Google Analytics, much of it in a breathless “Wow!” sort of tone. And, I’m afraid I’m yet another one! The thing that gets me is the sheer depth of information. I’ve just spent the last 15 minutes discovering that (in the first few hours of stats collection) that:

  • Most of my audience has a screen resolution of 1280×1024
  • About a third of my audience is using dialup
  • All of my audience has Java enabled (well, this is a rather small sample at this stage ;) )

In addition, of course, there’s the more “standard” stuff – where in the world your clicks are coming from (although this is down to the State level, which is rare for us Aussies – plenty of tools give you US state info, but not Australian), which pages are most popular, etc.

Up till this point, I’ve been using AWStats in a static configuration – stats are generated in the form of static pages once per day. A great tool that gives me a lot of good summary information, but it just can’t touch the depth of Google Analytics stuff. That said, I’ll still be keeping it. AWStats runs on my PC, so I can always access it, even if I lose Net access. And, being static pages, its blindingly fast.

(Google Analytics is no slouch, by-the-by. I think we’ve all come to expect good performance from Google, be it search, mail, whatever, so this is probably no surprise. But there are noticeable pauses from time to time – only 2-3 seconds or so – as you navigate around)

Anyway, it looks like I can say goodbye to another 30 minutes of my life each day. So many graphs, so little time! :)