Friday, March 7, 2014

Number of keyboards to produce the universe

This photograph was taken in Nuuksio at Mustakorpi on February 21st.

I commuted today by bicycle, and it is good. I discussed riding the bicycle with a colleague, and he is rather keen on it, trying to get me interested in taking part in road cycling events. Well, I think commuting by bicycle is a great thing, but otherwise my favorite sport is walking in forests and swamps, not so much riding the bicycle.

I had a look at the Javascript implementation of Infinite Monkeys N-GRAM Algorithm, and the code was even simpler than I thought; it couldn't be much simpler and still do something.

I haven't done any coding since a long time, and I even had to search for an editor which would understand Javascript. (TextMate works great.) I tweaked the code so that it generates a longer text instead of just one line, here is a typical result:

a really long time  they
  they could write the theorem's stated outcome
of the theorem's stated outcome
hypothesis theorem* says that if a bunch
as shakespeare  dickens  et al  however  as
on an equal bunch of
  however  as a random famous writer such
of essentially zero is
to produce the universe  hence the theorem's
  number of keyboards to produce the universe

Here I used as input a posting by Mark Hobson giving his interpretation of infinite monkeys, and the tenth line generated was quite all right to be used as the title of this posting.

It has been a long time since I did any "real" coding. My language of choice (and of necessity) was Fortran 90/95, and I also wrote some Mathematica/Matlab/Maple code. And a little bit of scripting with Python/Perl etc. But as I said, that was a long time ago.

But every once in a while it is nice to look into coding, or at least into a discussion on coding, such as Mt. Gox, money, and floating point arithmetic. It is good to see that the issue of coding style still goes strong as a topic of conversation. As well as the topic of language A vs. language B.

No comments: