Friday, December 4, 2009

A super long palindrome

Originally written on July 19, 2009

----------
I came across an interesting programming problem to generate Palindromes while reading a book on the good old C programming language.

If you don't already know, a palindrome is a phrase/word/sentence which reads the same backwards and forwards. Eg:

"A man, a plan, a canal - Panama" (Ignore the case and punctuation etc, focus on the letters).

The above palindrome is a classic, it shows the effort in building the Panama canal. Jim Saxe, a Computer Science grad student at CMU in 1983 extended this to the following:

"A man, a plan, a cat, a canal -Panama?"

Bragging by putting it up on his system for others to see it, he was soon parodied by someone from Yale:

"A tool, a fool, a pool—loopaloofaloota!"

Nonetheless, someone else soon extended the Jim's palindrome to:

"A man, a plan, a cat, a ham, a yak, a yam, a hat, a canal—Panama!"

This started a race to discover longer palindromes, which made sense to the ear. (It is pretty easy to come up with a program to generate meaningless palindromes)

Dan Hoey who had then recently graduated from CMU saw the palindrome obsession and tried to develop an ingenious program in C to generate one. His idea was to successively add letters on either side of the middle of the original Panama palindrome, the left image a reverse of the right one. In his resulting program, a finite state machine successively evaluated partial palindromes and added them to the original sentence. He used a small word list containing only nouns so that the resulting palindrome made some sense.

The program generated the following:

A man, a plan, a caret, a ban, a myriad, a sum, a lac, a liar, a hoop, a pint, a catalpa, a gas, an oil, a bird, a yell, a vat, a caw, a pax, a wag, a tax, a nay, a ram, a cap, a yam, a gay, a tsar, a wall, a car, a luger, a ward, a bin, a woman, a vassal, a wolf, a tuna, a nit, a pall, a fret, a watt, a bay, a daub, a tan, a cab, a datum, a gall, a hat, a fag, a zap, a say, a jaw, a lay, a wet, a gallop, a tug, a trot, a trap, a tram, a torr, a caper, a top, a tonk, a toll, a ball, a fair, a sax, a minim, a tenor, a bass, a passer, a capital, a rut, an amen, a ted, a cabal, a tang, a sun, an ass, a maw, a sag, a jam, a dam, a sub, a salt, an axon, a sail, an ad, a wadi, a radian, a room, a rood, a rip, a tad, a pariah, a revel, a reel, a reed, a pool, a plug, a pin, a peek, a parabola, a dog, a pat, a cud, a nu, a fan, a pal, a rum, a nod, an eta, a lag, an eel, a batik, a mug, a mot, a nap, a maxim, a mood, a leek, a grub, a gob, a gel, a drab, a citadel, a total, a cedar, a tap, a gag, a rat, a manor, a bar, a gal, a cola, a pap, a yaw, a tab, a raj, a gab, a nag, a pagan, a bag, a jar, a bat, a way, a papa, a local, a gar, a baron, a mat, a rag, a gap, a tar, a decal, a tot, a led, a tic, a bard, a leg, a bog, a burg, a keel, a doom, a mix, a map, an atom, a gum, a kit, a baleen, a gala, a ten, a don, a mural, a pan, a faun, a ducat, a pagoda, a lob, a rap, a keep, a nip, a gulp, a loop, a deer, a leer, a lever, a hair, a pad, a tapir, a door, a moor, an aid, a raid, a wad, an alias, an ox, an atlas, a bus, a madam, a jag, a saw, a mass, an anus, a gnat, a lab, a cadet, an em, a natural, a tip, a caress, a pass, a baronet, a minimax, a sari, a fall, a ballot, a knot, a pot, a rep, a carrot, a mart, a part, a tort, a gut, a poll, a gateway, a law, a jay, a sap, a zag, a fat, a hall, a gamut, a dab, a can, a tabu, a day, a batt, a waterfall, a patina, a nut, a flow, a lass, a van, a mow, a nib, a draw, a regular, a call, a war, a stay, a gam, a yap, a cam, a ray, an ax, a tag, a wax, a paw, a cat, a valley, a drib, a lion, a saga, a plat, a catnip, a pooh, a rail, a calamus, a dairyman, a bater, a canal—Panama.

The challenge given by the book is to use a real online noun list containing far more nouns and come up with a 10,000 word long palindrome.

Simple?

A geeky Christmas afternoon, and the perfect woman.

Originally written on Dec 25, 2008

----------

What does an international grad student in Electrical and Computer Engineering do on a Christmas afternoon in Amherst ? Explore Youtube.com, and waste the precious interweb's bandwidth.
Youtube.com is a hungry data-beast, it consumes and grows on flash videos, much like a caterpillar feeding on plants and insects. It is so huge, that it uses as much traffic as the web had in the year 2000. But not without a good reason - Youtube is democratic, fast, legal for the most part so RIAA can keep it in their pants, and devoid of porn.
Youtube made me feel more democratic. Searching for alternatives to the software tyrant of our days - Microsoft, I quickly navigated to Google labs - where the next generation cutting edge software is featured, all of it free, and some of it open for code inspection. That is where I found this geeky blog:

http://www.codinghorror.com/blog/

This gentleman ordered a pair of bare-bone computer servers, as his Christmas present. The servers are inoperable in their packaged state, and his endeavor is to make them functional by mounting hard drives and more memory. How could I not bookmark this page ? He wrote something about Uncanny Valley, which I was not aware of.
Uncanny Valley is in relation to a paradox : humans disdain technology as it creates more life like products. It is creepy to think of a robot resembling your previous crush, although it will be indeed a marvel of technology. The robot shown here on Youtube can play a Violin, although does not (and I hope not) look like your ex:



I appreciated the hot Japanese actroids , and was thinking of asking one out and buying them some system memory as a gift:



However, the Uncanny Valley syndrome quickly stirred up my senses when I found this:



Much like the Internet-mail-order wives, you can purchase this 'perfect woman' actroid from their website. Although lacking in sophistication than other robots (Asimo), the idea cracked me up - and angered me a little bit later. I hate chauvinism: Male, Female, Hindu, White - anything. And these folks are spearheading a campaign, marketing brilliant technological innovations by catering to the lowest psyche of males. I am waiting for the day when feminist groups can release their version of the perfect man actroid, which will be as distasteful as the perfect woman developed by these loonies.

2001: A Space Odyssey

Originally written on March 28, 2008

-----------

I recently saw 2001: A Space Odyssey for the third time on Netflix.com, and it left me more awed, more inspired and more perplexed by the cinematic genius of Stanley Kubrick. It is surprising how Kubrick can make excellent movies in diverse genres such as comedy (Dr Strangelove), relationships (Eyes Wide Shut), war (A Full Metal Jacket), infatuation (Lolita), horror (The Shining) and the all encompassing masterpiece `A Clockwork Orange'. 2001 can be dubbed as a science fiction/suspense movie. This motion picture creates a breathtaking imagery of space by using special effects and classical music. There are few dialogues and they do complete justice to the grand topics of human evolution, artificial intelligence and space exploration which this movie tries to address within its span of 148 minutes. After you finish it, you may find yourself guessing what happened and possibly engaging with your friends in `one of those' conversations about its meaning. Whatever you reason, your hypotheses will be debatable at best. The answers lie inside Arthur C Clarke's novel by the same name. Arthur Clarke assisted Kubrick with the screenplay.
This film was made in 1968 and was extremely ahead of its time, and holds its ground even today. The graphics used to create the colossal inter planetary spacecraft are very good and the sets do not appear lame. The music compliments the scenes at all times. The distinct opening theme composed by Richard Strauss has become a favorite of our times and can be commonly heard elsewhere. Kubrick uses music very smartly and does not swamp the viewer in long sequences which would have added little to the whole experience. For instance, the scenes where astronauts are engaging in EVA are devoid of any background score and you can only hear the breathing, taking you right inside the space suit.
I do not want to spoil the movie for people who have not watched it yet, but 2001 raises very pertinent philosophical questions about AI and the possibility of computer consciousness. We have seen a lot of movies of late in which some damned robot decides to overthrow humans ensuing some lame ass drama. HAL 9000 computer from 2001 however presents itself to be a less fancy but a very credible system which goes awry. The treatment of this serious issue is non glamorous and very straightforward.
If you have not seen it yet, please watch it. Although it will appeal more computer sc/ engineering majors, I think everyone who has a penchant for movies should be able to enjoy it.

Here is the trailer on Youtube:

About Me

Northampton, MA, United States
I'm a curious character who likes doing intellectually and physically demanding things.