Friday, July 31, 2009



Another game of chance with Pygame ! with a piratey touch to it ! The tokens used in the slot machine are (1) The Jolly Roger (2) Pirate mate (3) Anchor (4) Treasure-map and (5) Gun.

5 Tokens , 3 slots ! ......

Fig1. Randomisation is achieved with 3 variables

May be the best game of chance I have made , the obvious thread can be traced to Pygame Dice and Pygame Toss discussed here earlier.

Fig2. Start-up screen

Fig3.User-Input Screen

Fig4. 'Loser' Getting all 3 different tokens

Fig5. 'Good Job' Getting at least '2' similar tokens

Fig6. 'Winner' Getting all '3'

Video1. Pirate slot-machine

Sunday, July 19, 2009



Extending the idea of tossing a coin to the throw of a pair of dice. The throw doesn't have equal probable events , ie: Probability of getting a cumulative sum of 10 is not the same of getting a cumulative sum of 7.

The probabilities of rolling a cumulative sum of 'n' is maximum for rolling a 7 (16.67% , lucky seven) while it is the lowest for rolling a 2 or 12 (2.78%).

To allow the user to have the 12 choices (2-12 and Quit) two variables are used as posx and posy (single variable pos used in the toss of a coin), to make a grid.

Fig1. The start up screen

Fig2. The user interface

Fig3. The Result screen (1)

Fig 4. The Result screen (2)

The coding gets lengthy due to the 36 possible outcomes of the event. The lines of codes tally to nearly 1450 across 2 python files.

It is worth noting that throw of a single die is an equal-probable event with all events bearing a 16.67% probability thus programming such an interface would be lot easier and just matter to add on to the toss of a coin code.


Video 1. Pyagame Dice

Saturday, July 18, 2009



Something very conspicuous about software and programming languages are that they are named in rather peculiar manner. Sometimes it is a play of words as WINE (Wine Is Not an Emulator) and XNA (XNA is Not Acronymed) to those named after some scientist or mathematician as Ada, Turing, Pascal etc , then there are also those named after some entertainment/cartoon character as Linda (allegedly named after porn star Linda Lovelace) , Python (named after the comedy group Monty Python) and Django (named after jazz guitarist Django Reinhart).

Fig1. The British comedy group Monty PYTHON

Fig2. Jazz Guitarist DJANGO Reinhardt


An open source web development tool , developed in 2005 for maintaining news websites for The World Company , Lawrence , Kansas.

Versions 1.0 and higher , released in early 2009 has been lot different than the previous version of 0.96.

Just to check everything is in order ..... check the django version and django-admin must be on the path !

Fig3. DJANGO version in python shell

Fig4.'' must in the path


After the efforts , it is soothing to see the pastel blue 'IT WORKED'

Fig5.First Django page


Hello World and time is made modifying the views and urls file.

Fig6. 'Hello World'

Fig7.Time in Django , refreshing the screen updates the recent time

Fig8.'Hello World' and 'Time'

Fig9.Error 404 , the is no special page


2 references used by me are ,

(1) The Definitive Guide to Django , 2nd Edition

(2) Django 1.0 WebSite Development