Unicode, freaky puzzle

Nnna

Tim Bray's blog has a good easy introduction to Unicode. It's also got an interesting selection of glyphs shown close-up.

If you like weird and wonderful characters, look no further than the Tamil code chart. Most of the Tamil characters seem to be made up of baffling loopy bits. Here are my favourites:

U+0B87, TAMIL LETTER I

The Tamil letter I

U+0B94, TAMIL LETTER AU

The Tamil letter AU

U+0BA3, TAMIL LETTER NNA

The Tamil letter NNA

I'd love to know what the difference in pronunciation is between ‘Nna’ (U+0BA3, above) and ‘Nnna’ which looks the same but with one less loop. According to the Unicode tables, Tamil also has letters called ‘Na’, ‘Nya’ and ‘Nga’.

Argh, I hate ‘brain-teasers’

Tim Bray's blog also pointed me to an interesting article about an annoying puzzle. The solution is sufficiently counter-intuitive that I had to write a Perl script to test it (like the guy says in the article, you have to try it empirically before you believe it):

#!/usr/bin/perl -w
use strict;

# Usage: perl monty.pl 1000000 switch
# (where 'switch' is 1 to switch doors, or 0 not to)

my $total = shift;
my $switch_doors = shift;
my $wins = 0;

foreach (1 .. $total) {
   # The winning door is 0, 1 or 2, with an equal chance of each.
   my $winning_door = int rand 3;
   my $chosen_door = int rand 3;

   my $opened_door = other_door($winning_door, $chosen_door);
   if ($switch_doors) {
      $chosen_door = other_door($chosen_door, $opened_door);
   }

   ++$wins if $chosen_door == $winning_door;
}

printf "You win %d%% of the tries ($wins out of $total)\n",
       $wins / $total * 100;


# Pick the first door which isn't amoung any of the ones given as arguments.
sub other_door
{
   DOOR: foreach my $door (0 .. 2) {
      foreach (@_) {
         next DOOR if $_ == $door;
      }
      return $door;
   }

   die "I couldn't find a spare door that isn't one of (" .
       join(', ', @_) . ")\n";
}

Anyway, somehow it does work out like the article says. It's better to switch doors:

$ perl monty.pl 1000000 0
You win 33% of the tries (333062 out of 1000000)
$ perl monty.pl 1000000 1
You win 66% of the tries (665685 out of 1000000)
 

I never understood probabilty, and I don't think I want to.

< More thoughts on RSS | An evening at the ballet >

Miniblog

(nuggets of inanity)

Tuesday Apr 24th 2007, 16:54 »
Just took the annual web design survey that AListApart do. I don't realy consider myself to be a web designer, but I have been doing a lot of HTML and CSS lately.
Monday Apr 23rd 2007, 18:23 »
Strange, there appears to be a bare-knuckle boxing match going on in the field outside my flat. Wish they wouldn't make so much noise about it.
Thursday Mar 1st 2007, 18:47 »
“In its written form, Hebrew has no vowels, making it the ideal language for texting.”
—Said in jest on some Radio 4 programme just now.

Archive: 2007 · 2006 · 2005 · 2004
Feed