I use this blog as a soap box to preach (ahem... to talk :-) about subjects that interest me.

Thursday, January 26, 2012

US Troops

I was reading the article "The Strategist" in the current issue (Monday, Jan. 30, 2012) of Time Magazine and found some information that I would like to share. As it is a small amount of data hidden inside a figure, I am confident I am not violating any copyright law (one cannot ever be careful enough these days...)

I find it interesting because it answers the question: in which country are US troop present and how many?

Here is the list of troops presence (with the countries listed in no particular order):

> 50,000 U.S. (not surprisingly), Afghanistan (again, a well known fact), and Germany.

1,000 .. 50,000 Spain, UK, Belgium, Italy, Turkey, Iraq, South Korea, Japan, Bahrain.

100 .. 1,000 Australia, The Philippines, Thailand, Singapore, Saudi Arabia, Djibouti, Egypt, Greece, Portugal, Panama, Cuba (of course: Guantanamo), and Canada.

None (at least, not officially ;-) North Korea, Papua New Guinea, Malaysia, Iran, Albania, Belarus, Iceland, Eritrea, Somalia, Malawi, Swaziland, Lesotho, Namibia, Equatorial Guinea, Central African Republic, Benin, Burkina Faso, Guinea Bissau, Gambia, Western Sahara.

All other countries have a presence of between 1 and 100 U.S. troops.

I thought: perhaps Time counted as troops the few marines attached to U.S. embassies. But this is not the case because, according to Wikipedia, sixteen of the twenty countries that Time lists as not having any military presence do have a U.S. embassy (excluded are "the usual suspects": North Korea, Iran, Somalia, and Western Sahara).

This means that U.S. soldiers are present almost everywhere (101,000 further troops are at sea).

I find this amazing. Don't you?

Sunday, January 8, 2012

End-of-year Cleanup

I should have published this story on January 1st, but better late than never.

As you perhaps know, I grew up in Rome (Italy).  On the last day of each year, the busses stopped running a few hours before midnight and retreated to their depots.  But it wasn't simply to give to drivers and conductors the opportunity to celebrate the coming of the new year with their families.  It was to ensure their safety.

Yes.  Their safety, because when I was a boy, it was a Roman tradition to dispose of unwanted stuff by throwing it out of the window.  Literally.

Why bring junk to the tip when you can simply throw it out?  Beside being simpler and more economical, at a time when the majority of people could not afford to buy a car, it was fun!

Can you imagine the impact of an old easy chair when it hits the sidewalk after a "jump" from the fourth or the sixth floor?

You could throw out everything, including old sinks and toilet bowls, with seat and all.  A walk in the early hours of the new year, before the teams of garbage collectors started the thankless task of cleaning up the streets, was a unique experience.  In some quarters you literally had to walk in the middle of the street in order to negotiate your way through.  At least, with all the broken glass and empty cans littering the streets, there was no chance that a car would be around to hit you.

I lived with my parents, sister, and grandmother, on the third floor of Via Alessandria 119, just outside the high wall that the Romans built around the city some two thousand years ago.  It was quite central, and very near the place where the troops of the Kingdom of Italy breached the wall on 20 September 1870 to "liberate" Rome from the Vatican.

Anyhow, here is a nice snapshot of the street "borrowed" from Google's street view.  You can see the entrance door and the windows.


From one of those windows, my family and I enjoyed the view of the "new-year dumping" and, sometimes, threw something away ourselves, although I don't remember that we ever got rid of very bulky items.

One year, when I was between four and seven years old, we had a carton of persimmons who had become a bit too ripe.  Who knows why we had it, but I remember that at midnight of December 31st we used them to bombard a car that somebody, very imprudently, had left parked on the other side of our street.  The fruits were very soft, and I am sure that we didn't do any damage to the car, but I can only imagine what its owner must have thought when he saw it completely covered by a orangey sticky goo.

I wouldn't do it now, and I cannot imagine (but don't know it) that Romans still throw rubbish out of the window on the last night of the year.  Still, at a time when very few families had a TV set or money to spend on fireworks, it was of great entertainment.

Italy is much more civilised these days...

Sunday, December 25, 2011

Montana, where are you?

This blog gave me two nice surprises for Christmas: the first visitor from Algeria and the first visitor from North Dakota.

Now, I am only missing visitors from one of the United States: Montana.

If any of you knows somebody who lives in Montana or happens to make a trip to the headwaters state and connects to the Internet, it would be nice to have the remaining US-state flag...

DNA

Some days ago, I started reading the book "The Making of the Fittest" by Sean B. Carroll and I cannot put it down.  Finally, a book that explains how the study of DNA proves beyond any doubt that Darwin was right with his theory of evolution.  A clear and uncluttered explanation of how DNA works.  In fact, I like it so much that I will try to summarise it (!) here.

DNA consists of a double chain (or "strand") of compounds called "Nucleotides" (although, to be precise, not all compounds called nucleotides are to be found in DNA).  A nucleotide (also called "Base") is a simple molecule with one or two dozen atoms.  Four bases exist: Adenosine (A), Cytidine (C), Guanosine (G), and Thymidine (T).

Each base in a strand is linked via a Hydrogen bond to a base in the other strand: the As are linked with Ts and the Gs are linked with Cs.  That's how the two strands of DNA are kept together.  This means that for every A in one strand, there is a corresponding T in the other strand, for each C a G, for each G a C, and for each T an A.  Therefore, each strand contains the same information.  In other words, a DNA molecule contains the same information twice, once in each strand.  That's why you will find in the literature the description of DNA as consisting of "base pairs".  The Human DNA consists of about three billion base pairs.

A "gene" is a sequence of about 1200 base pairs that contain the information to build a protein, and humans have something between 20,000 and 25,000 genes.

A chromosome is only the name given to a portion of DNA.  That is, the fact that we have twenty-three chromosomes only tells you that our Genome (collective name for all our genes) is not contained in a single molecule of DNA but in a series of separate double-strands.  Chromosomes are important but, somehow, I don't find them very interesting, although, I might change my mind.  You can find a list of the number of genes and base pairs in each human chromosome here: http://en.wikipedia.org/wiki/Chromosome.

When a cell wants to generate a protein (don't ask me when and why that happens), it "transcribes" the sequence of one of the DNA strands of the corresponding gene into a single strand of what is called "messenger RNA", or mRNA.  mRNA is a sequence of nucleotides similar to a DNA strand, and repeats the DNA sequence of the gene but with an A for each T, a C for each G, a G for each C, and a U (Uracil, another nucleotide) for each A.

Proteins are chains of simpler compounds called "Amino Acids", which are quite simple molecules containing nitrogen.

The cell "translates" the strand of mRNA into the corresponding protein, one amino acid at a time.  To do so, it scans the nucleotide sequence of the mRNA in groups of three, and each triplet (which is called a "codon") of nucleotides identifies a particular amino acid.

Let's see: there are four different nucleotides in mRNA (A, C, G, and U).  Therefore, a group of three nucleotides can identify 4 x 4 x 4 = 64 amino acids.  In fact, there are only 20 amino acids (which is very convenient, because they can be identified by a single letter of the alphabet, as shown in http://en.wikipedia.org/wiki/Aminoacid).  This means that several triplets of nucleotides identify the same amino acid.  Note that pairs of nucleotides (instead of triplets) would have not been enough, because they could have only identified 4 x 4 = 16 amino acids.  In any case, there are also some codons that are used to "stop" a sequence.  When the molecule encounters a stop codon, it stops building up the protein.

Obviously, as each gene has on average some 1200 bases and three bases are needed to identify an amino acid, the average protein contains 1200 / 3 = 400 amino acids.

It turns out that about half of our DNA is "junk", left behind by genes that were no longer needed and have decayed due to natural mutation or resulting from the random duplications that often occur.

As you might have heard, evolution is due to variations (i.e., DNA mutations), selection, and time.  DNA frequently mutates for various reasons (for example, when a nucleotide is replaced by a different one), but it can also happen that entire sequences of base pairs are either duplicated or lost.  If the "new" gene is viable, the corresponding protein sometimes turn out to be advantageous for the carriers of the mutated gene.  In those cases, if the gene is passed on to enough new members of the species, even a little advantage can, after enough time, cause a complete replacement of the "old" gene.

Even minute advantages due to the presence (or absence) of a gene have, on the long run, significant effects.  Einstein (I believe) compared them to compound interest: even a small percentage, over many years, can result in substantial figures.  And evolutionary periods are measured in centuries and millennia, when not in millions of years.

If the mutation is damaging, the same mechanism of natural selection "purges" the DNA.  That's how some genes have remained unchanged for, literally, billions of years and can be found in almost all species.

It can also happen that, due to mutated environmental conditions, a particular gene ceases to be advantageous.  In those cases, natural selection no longer operates.  With time, as the gene mutates, there is no longer a mechanism to purge the DNA of those mutations that make the gene unviable.  As a result, eventually, all genes that cease to be advantageous decay and become irrelevant.  These fossil genes contribute to the junk base pairs in our DNA.

The fact that genes disappear is a big blow to the proponents of "Intelligent Design".  Isn't it?

There are genes that provide the material needed for our organs, and genes that regulate how those proteins are organised.  How these regulating genes do their job depends on a series of base-pair sequences in our DNA (called "Switches"), like a computer program depends on its parameters.  Changes in those switches can result in dramatic differences at the macroscopic level, because they also set things like the number of limbs.

Fascinating!

Tuesday, December 20, 2011

Lacing Shoes

Almost one and a half years ago, I posted an article about how to fold toilet paper (Toilet paper woes).  Today, I would like to write about another simple task that often doesn't receive much attention (except by me, that is): how to lace shoes.

After deciding to write about this neglected subject, I discovered a great website entirely dedicated to the different techniques for lacing up shoes: Ian's Shoelace Site.  Very thorough a professional.

Perhaps not surprisingly, the discovery of Ian's site didn't deter me from writing here my reflections on the subject.  Ian shows diagrams for 36 different ways to lace shoes, but I will concentrate on the three methods that, as far as I can see, are used by the vast majority of people.

Here is the first method, in which one side of the lace spirals through all eyelets and the other side goes through to one of the two top holes:

The advantage of this method is that, if the two sides can come close together, the loops are parallel to each other.  This appeals to many, and I have often found that this method is applied by salespeople.  Perhaps they do it because, with this method, you don't need to count holes.

I hate this method.  After a while, it tends to skew the holes, as one of the bottom ones is strongly pulled towards the top.  It is also somewhat more difficult to open up the shoe, and the side of the lace that loops through tends to remain loose in the middle.  Besides, I like symmetry.

One variation of this method is as follows:


As you can see, both sides loop through each second pair of holes.  The loops remain parallel in front, while the skewing effect is significantly reduced.  But I still don't like it, because it remains asymmetrical and (don't ask me why) somewhat unnatural.

The third method I would like to show you is completely symmetrical.  Here it is:

In the example shown, the lace always go through the eyelets from the outside to the inside.  This is in fact a variation of the most common technique, in which the lace starts from the inside and always go through from the inside to the outside.  The result is a zip-like pattern that is quite pleasing.  Like in the previous cases, it doesn't require you to count the holes.  But it has two disadvantages.  The first one is that you cannot bring the two sides of the shoe completely together.  It is not a problem in the example, but I had sometimes shoes in which the two sides even overlapped.  The second disadvantage is that the two sides of the lace rub against each other, thereby making it somewhat more difficult to open and close the shoe.

The final method is the one that I consistently use.  Although, for the best effect, it requires you to count the holes (in, out, in, ...), it represents in my opinion the most pleasing solution in terms of symmetry, low friction, and applicability.


It is also nice to see the Xs formed by the laces inside.  Or not?

A Puzzling year indeed

In yesterday's article, I forgot to say that in 2011 I also developed a CalcuDoku-solving game for the iPad (search iTunes for CalcuDokus and you'll find it in your local iTunes store).

I first made a $0.99 version with 100 puzzles, and then a free version with 17 puzzles and advertisements.

Despite my attempts at getting some review sites to look at it, the results were quite disappointing.  Apple's AppStore is saturated with applications, and it has become very difficult to get noted.  Big games-developing companies systematically hit jackpots, but nanodevelopers like me have close to no chance.

Far from me the idea that my application is exceptionally good and overlooked.  But I am pretty sure that a couple of years ago, it would have sold reasonably well.  So, why did I wait for 2011 and a saturated market before developing for the iPhone/iPad?  Because I am stupid.  That's why.  I did the same with the Web: in the early nineties, instead of being one of the first web developers on the market, I developed an application for the Mac (MacDOS) that went nowhere.

Another missed opportunity...

Monday, December 19, 2011

A Puzzling Year

This has been a year during which I have concentrated on developing puzzles and writing about it.  I had always been interested more in developing programs to generate and solved numeric puzzles than to solve the puzzles themselves.  Towards the end of 2010, I finally dedicated myself to it.

The first thing I did was to write two programs to generate and solve Sudoku Classic puzzles.  I also added to the Generator the code necessary to create pattern Sudokus (i.e., puzzles in which the initial clues are arranged in a pre-determined way).  Once I was done with Sudoku Classics, I wrote a program to combine five pattern Sudokus into a Samurai Sudoku puzzle.

This work on Sudoku resulted in my first puzzle book, Sudoku Programming, which I self published at the beginning of April.  365 pages of strategy explanations, walk-throughs of "C" code, and examples.

Shortly after that, I thought that a book describing in detail the strategies to solve Sudoku Classic puzzles could be useful, and wrote Sudoku Explained, a booklet of 94 pages that I published at the end of May.  I offered it to the game shop Mind Games, that has since sold some copies.  Forget what they say about eBooks.  In terms of satisfaction, nothing compares with seeing your printed books on the shelves of a physical, old fashion, shop.

I had designed the head with the "Sudoku Brain" for my first book, and had the idea of placing small heads on the two sides of my name.  But, after flipping the small head to place on the right-hand side of the cover, given my perfectionism, I flipped each digit inside the brain back to its original direction, so that they could be read.  The devil is indeed in the details...

At that point, I decided that "C", after all, was less popular than Java, and decided to rewrite all my Sudoku programs in Java. This took a few months during the middle of the year.  After that, it seemed natural to rewrite "Sudoku Programming" for Java.  This time, I chose the more catchy title How to Create Your Own Sudokus with Java.  I contacted some publishers and also some agents, but nobody was interested in publishing it.  They all claimed that it was a very difficult book to place.  As a result, once more, I decided to publish it myself.

But while I was looking for a publisher for my Java book, I started working on another puzzle: CalcuDoku (see several recent articles in this blog).
I developed a program to generate and solve CalcuDokus, but this time I decided not to write books that explain how the programs work.  Similarly to what I had done with Sudokus, I wrote a program to compose CalcuDokus into larger puzzles.

Over the past couple of months, I have published three books of puzzles: 200 Puzzling Hearts, with 200 heart-patterned easy Sudokus, 200 Puzzling Shamrocks, with 200 difficult Sudokus patterned like four-leafed clover, and 100 Double CalcuDokus.

     

I am currently publishing what is going to be my last puzzle book (at least, that's what I am thinking now): 50 Samurai CalcuDokus.  This book has a larger format because the samurai puzzles are LARGE!



Next year, I will have to work on something else.  I confess that I feel a bit saturated with puzzle programming.  Perhaps, I will resume writing my historical novel Ciao Biondina.  But also a crime novel or an alternate history might inspire me.  We shall see...

Thursday, December 8, 2011

Double CalcuDoku #2

I can now generate Double CalcuDokus with any overlapping, although, at least for the time being, the overlapping region can only be a square.  Here is an example of a 6x6 overlap:



I find puzzles with large overlaps more interesting. It makes it easier to exploit the fact that the cells of each row and columns that are not share must coincide.  For example, in the above example, the three bottom cells of the middle column of the right puzzle include two singles: a 4 and a 2.  This means that also the top three cells of the same column must include a 4 and a 2.  As the 2-cell cage "9x" cannot possibly contain an even digit, it means that the they must be in the other two cells.

And here is an example of a 7x7 overlap:



The "edge effect" is particularly strong when the overlapping is 7x7, and makes the solution of the overall puzzle easier.  To keep the difficulty at a challenging level, I have therefore tweaked the configuration parameters and made the individual puzzles a bit more difficult.  Notice that in the above example there are three 5-cell cages and seven 4-cell cages.

I have just published a book with one hundred puzzles:


You can buy it in print from Lulu for US$9.99 or in several eBook formats from Smashwords for US$0.99.

Friday, December 2, 2011

Double CalcuDoku

I imagine that you are familiar with the double Sudokus like the following one:



I though: wouldn't it be nice to make overlapping CalcuDokus? Well, here is the first one I generated:


As you can see, I overlapped a 3x3 area. To explain how this works, I have coloured the puzzle, which is normally in B&W. The two squares are two normal CalcuDokus, but the green area belongs to both the yellow and the blue puzzles.

Notice that cages can cross the boundary. For example, the right-side cell of the 2-cell cage "2:" belongs to both puzzles, while its left-side cell only belongs to the yellow puzzle.

As I don't like puzzles that admit multiple solutions, I ensured that the program delivers a unique solution. The interesting thing with overlapping CalcuDokus is that they can overlap by any amount of rows and/or columns, while Sudokus, to maintain the integrity of the boxes, can only overlap by 3 or 6 rows and/or columns.

For the time being, my program only supports an overlapping of 3 rows and 3 column, but I am going to parameterise it. Then problem is not in generating and solving the puzzle, but in displaying it.

Concerning the name to give to these puzzles, I thought that Niken would be a nice possibility. This is because "Ni" means "two" in Japanese and KenKen (which is a registered trademark of Nextoy LLC) is much more widely known than CalcuDoku. In any case, "CalcuDoku", as a name, is quite long on its own. As "Ken" is a normal Japanese word (which, as you probably know, means "wisdom"), I don't believe that Nextoy could accuse me of infringing their trademark. I could also call it KenTwo or TwoKen but, somehow, it doesn't seem right. Also Kenni is not good. What do you think?

Saturday, November 26, 2011

KenKen and CalcuDoku

I found three websites that let you play daily KenKen (® Nextoy LLC) /CalcuDoku puzzles: kenken.com, calcudoku.org, and my website zambon.com.au.

While the other two websites include puzzles of different sizes, and calcudoku.org also includes variants, my website only includes 9x9 puzzles. KenKen and CalcuDoku are the same puzzle, but their implementation is done by different people. Each implementation has a different feel and, on average, different levels of difficulty.

I know how my puzzles are developed, but, obviously, I have no idea what algorithms the other developers use. I thought it would be interesting to identify some of the differences from a statistical point of view.

For this purpose, I analysed 10 puzzles taken from each website. I know that 10 is too small a sample to make good statistics, but it was a lot of counting...

Anyhow, what follows is a summary of what I came up with. To avoid repeating the domain names, I will use K to identify kenken.com, Z for zambon.com.au, and C for calcudoku.org. ‘A’ indicates values obtained by averaging all. The triplets of numbers indicate minimum, average, and maximum values.

Number of cages: K=[31, 33.2, 38]; Z=[32, 34.3, 37]; C=[33, 34.2, 35]; A=[32.0, 33.9, 36.7].

The average number of cages is for everyone around 34. But it is interesting to note that K's spread is 7, Z's is 5, and C's only 2. This might indicate that, while K and Z do not set any limits to the number of cages, C determines the cages not completely as a result of random choices. This might be consistent with the fact that C sometimes presents puzzles that have the cages arranged in particular patterns (although none of the puzzles I randomly picked belonged to that group). It would be interesting to know what Patrick (C's developer) would have to say about this.

With larger samples, I expect that Z's (i.e., my) number of cages would turn out to be normally (i.e., randomly) distributed. Actually, as I generate the puzzles, I don't need to do the counting, because the computer automatically lists for the number of cages. I can check it out right now.

...

It turns out that the number of cages calculated for 100 Z's puzzles is [32, 34.83, 38].

The following image shows how the normal distribution (the magenta squares) fits to the measured values (the blue diamonds; these are the default of Excel and I didn't bother to change them). The vertical bars represent a standard deviation from the normally distributed values. In other words, if the distribution reflects reality, there is a 68.2% probability for each measurement to fall within the bars. At the very least, the plot confirms that the number of cages in my puzzles is not in disagreement with a normal distribution. I confess I would have been shocked if it had not been so, because the distribution is the result of several [pseudo]random choices...


The following table summarises the counts of operation codes and cage sizes.


C has about 6 times the number of 1-cell cages that K and Z have, and half the number of 2-cell cages.  I will go out on a limb and say I believe that such differences are not due to statistical fluctuations within the samples. C also seems to have fewer divisions (1.3 vs. 3.5 and 5.5) and more cages with more than 3 cells (6.4 vs. 3.1 and 3.9). It seems reasonable to assume that the lower number of divisions (and perhaps subtractions) is due to the lower numbers of 2-cell cages.

In general, I have the impression that C's puzzles are more difficult than those of K and Z, and it seems reasonably safe to assume that the higher number of large cages is a contributing factor.

To deduce more from such a small sample would be inappropriate.

Sunday, November 13, 2011

Catholic Church? No Thanks!

I just published with Smashwords a short book titled Catholic Church? No Thanks!.

It collects a series of short pieces about the Catholic Church that I wrote over a period of time. They describe some events that occurred to me and some of my reflections on how the Church operates. I was never a fervent Catholic, but this booklet explains some of the events that contributed to my Atheism.

Tuesday, November 1, 2011

You can buy CalcuDoku for the iPad

My application to play CalcuDoku on the iPad is finally available in the iTunes App Store:



You can also check it out on itunes.apple.com

What are you waiting for?  http://planetsmilies.net/happy-smiley-567.gif

Sunday, October 23, 2011

Same-sex Marriage

Yesterday I talked about boat people.  Today, I feel compelled to write a short note about another issue that is being hotly debated in Australia.

Saturday, October 22, 2011

Boat People

Every year, some thousand people are desperate enough to attempt the dangerous crossing from Indonesia to Australia on rickety boats.  They pay thousands of dollars to the unscrupulous operators who own the boats, in the hope that they will be allowed to remain in Australia as refugees.

The CalcuDoku application for the iPad is ready

I have just uploaded the CalcuDoku application for the iPad to Apple’s application store.  They could still find something I didn’t do right and reject it, but I think (and hope) that everything will go smoothly.  I don’t know how long it will take before it will appear in the AppStore, though...

Unfortunately, I am also not sure that it will be available in the Australian Apple store.  The problem is that I am not registered for GST (for the non-Australians: GST stands for Goods and Services Tax and is Australia’s 10% value-added tax).  It is only compulsory to register for GST if your Australian business revenue exceeds 75 kAUD, and it is such a bureaucracy that you don’t really want to get into it unless you do have such an income and/or incur significant GST-deductible expenses.

It is not clear to me whether Apple will simply not pay me when they sell my application in Australia or (more likely) the Australian residents will be unable to buy the application locally.  In any case, they should still be able to buy it from the US store for USD 0.99 instead AUD 0.99 (actually a cent or two cheaper).  We shall see.

Now that this application is done, I will go back writing fiction.  I confess I am a bit fed up with programming.  As I said in a previous article, Apple’s development environment is great, but not bug-free.  In a couple of occasions, I had to find some workarounds to get done what I needed.

Monday, October 17, 2011

Why a bladder?

I have always had some of my most interesting ideas during the periods of drowsiness that precede and follow sleep.