The 12 Coins Puzzle

November 14th, 2012

I recently came across this puzzle:

There are 12 coins, all identical in appearance, and all identical in weight except for one, which is either heavier or lighter than the remaining 11 coins. Determine which is the counterfeit coin in only 3 weighings with a balance scale.

After struggling with this, both mentally and using pencil and paper, I decided to write a web page to simulate the problem; it can be found here. You may find it interesting to attempt this puzzle there before reading the discussion below. Read the rest of this entry »

My first Android app

July 15th, 2011

I have been dabbling with Android development on and off for a little while now.

Android apps are usually written in Java, and having never used Java before, I have had to teach myself the basics of Java.

I wanted to start with a very basic app so I decided to convert an existing app that I had written in C# to run on Android.

The app is SolveX and I have written it to help me when I get stuck with a crossword, which seems to happen all the time. It uses SQL to find matches for the words I am stuck on. Having a database of over 105,000 words it usually manages to find the right word. 

 I have used this app on a personal basis for some time now although I had not released it on my website.  I have taken this opportunity to tidy it up, seperating the presentation from the logic by dividing it into seperate classes, and it is available now at my website.

The conversion to Android went quite smoothly, after I had converted the database to use SQLite, as used by Android.  

The only issue that I had  was how to deploy the database, which was a file of over 3Mb.  I eventually decided to store the database on a web server and deploy the app without the database.  When the app is used for the first time it connects to the web server and copies the database to the user’s device.  This only needs to be done on the first occasion the app is used. 

The app is now available at the Android market with a download size of 34k.

Dragon Age

July 14th, 2011

I have recently been playing the CRPG (Computer Role Playing Game) Dragon Age. This was recommended to me by a reader of a previous post on RPGs. Incidentally Dragon Age has been written by Bioware, the team that created my favourite CRPG, Baldur’s Gate.

I am completely hooked by the plot and game play of Dragon Age. It manages to create a complex and consistent game world. I care about what happens to my character and his companions. The game keeps me wanting to go back for more, wondering what is around the corner.

The graphics are superb, much better than from the days of Baldur’s Gate. The interface is very intuitive. The only thing that I miss from Baldur’s Gate is the ability to manage each individual character’s inventory, although arguably it is better to treat the inventory as a party asset and manage it as such.

The companions in Dragon Age also seem to have better AI, in that they react in much more varied ways to your actions.

I hve been playing this game virtually every free minute for the past two weeks. The fact that I am playing it at 1 O’clock in the morning demonstrates what a brilliant game it is. If you like CRPGs I can recommend this whole-heartedly.

Calculating Permutations

August 22nd, 2010

I recently came across this problem:

Find the only 10 digit number which uses each of the digits 0 – 9 and has the following property: The number formed by the first n digits should be divisible by n. That is

  • The first digit should be divisible by 1
  • The number formed by the first 2 digits should be divisible by 2.
  • The number formed by the first 3 digits should be divisible by 3.
  • And so on until the number formed by the first 10 digits should be divisible by 10.

Read the rest of this entry »