Fractal Christmas Tree on Your Mobile – My Christmas Gift to You

Jad and Jar files: Christmas.jad, Christmas.jar
Source: Christmas.zip

Here is a little gift from a geek to fellow geeks. This fractal Christmas tree can be run on your mobile phone. It is written using Java ME, utilizing the amazing LWUIT toolkit from Sun. You can configure various parameters and change the look of the tree.

What is a fractal?

A fractal is a self similar structure. We encounter fractals everyday. Objects like trees, clouds, mountains etc. exhibit self similarity, i.e., a part of the object resembles the whole.

What is LWUIT?

Writing mobile applications for Java ME (formerly J2ME) is quite easy, but writing professional looking applications is not. You had to shell out lot of money to use commercial toolkits to make your life easier. Sun hopes to change all that by releasing LWUIT, a toolkit that resembles Swing in many ways, for free.

A little bit of history

I wrote my first fractal Christmas tree long time back. It was published in a computer magazine called SysReader, in the Dec 1994 edition. I wrote it in Turbo Pascal. So when I was looking to learn LWUIT, and also since it is around Christmas time, I simply recalled the math & logic and rewrote it in Java ME in a matter of hours. From what I can tell, programming wise very little has changed since 1994!

Will it run on your mobile?

Most likely, but you’ll have to find it out. Download the Jar & Jad files given below, and transfer it to your device (via bluetooth, data cable etc), and install it, like how you install games. It works fine on my Motorola A1200 (Ming), and looks fine on the emulator. It should adopt to screen resolutions – your mileage may vary. If it doesn’t work, you have the code as well. Feel free to tweak it and try it out.

A word of caution – Increasing the number of levels & segments will dramatically increase the recursion levels and would slow down the mobile or cause it to hang. Use with discretion.

Downloads

Jad and Jar files: Christmas.jad, Christmas.jar
Source: Christmas.zip

For unto you is born this day in the city of David a Saviour, which is Christ the Lord. – Luke 2:11

Wish you a happy Christmas!

2 Responses

  1. Padman
    Padman March 27, 2009 at 3:21 am |

    Have used this in my mobile. It is very good. Let me know if you have some games that you have done. My son will be interested. :-)

Leave a Reply