2010/03/30

Easter Egg Hunt

Easter is coming up!

 

As a kid, I always looked forward to Easter.  My dad would make a treasure-hunt style Easter egg hunt, where each egg contained a little slip of paper that lead to the next egg, and finally to a basket filled with goodies.  As we got older, the domain of the eggs grew from in and around our house to, say, the neighbors pool.  The famous example is an egg that was thrown into the middle of a locked chain-link batting cage at the local elementary school a few blocks away.  We had to ride our bikes up there and figure out a way to get it out.  I think we used sticks or a broom or something to poke it to an edge so we could grab it.  Good memories, and almost certainly helped foster my attraction to puzzles.

 

And this year, I get to pass that tradition on!  I don't know if Allison quite has the IQ or the attention span to do a treasure hunt, but I'm going to give it a shot.  My plan is to start pretty basic.  I think I'm going to take a camera over to my parents house this week and take pictures of each egg hiding spot.  Then print out the pictures, put them in the eggs, and hide the eggs to match the locations of the pictures.  She'll probably need some hand-holding, but I'm really curious to see if she grasps the concept or not.  (Next year, it will be hexadecimal ASCII and semaphore flags.)

 

Speaking of IQ and development and stuff, Diana and I are constantly surprised by Allison's memory.  I guess we think that because she's illiterate that she somehow can't remember things, too.  So it's always a little bit of a shock when we go to a park that we haven't been to in weeks and she'll remember something about the last time we were there, like if she saw a dog or something.  This is probably obvious, but memory clearly develops much more quickly than other cognitive skills.  Go figure.



2010/03/23

4 Letter Word Square

Warning.  Highly geeky content follows:

A while back, my parents were over visiting.  While my mom was playing with Allison, my dad and I started playing with Allison's magnetic letters. We were taking the letters (26 of 'em, no duplicates) and trying to arrange them in a three-by-three grid such that there was a word formed across each row, as well as down each column.  After some minutes of trying, we didn't come up with any arrangements.  Close, but not quite perfect.

 

In my free time at work, I wrote a program to look for such arrangements, and found that there are many, many of them.  In the face of dozens of solutions, I felt a little sheepish.

 

For example:

ASK
PIE
TRY

 

Reading down the columns, you get APT, SIR, and KEY.  Note that no letter appears more than once.

 

When I told this to my dad, he (bless him) said "I wonder if there are any four-letter word squares?"  Sounded like a good challenge to me.

 

In my dictionary file, there are 2000+ four letter words.  I want to lay these words out horizontally into four rows, like this:

 

FOUR

WORD

LIKE

THIS

 

Once I have them in this arrangement, I want to test for letter uniqueness, as well as if the columns are also creating words.  In this case, I'd get FWLT, OOIH, URKI, RDES.  Obviously not words.  I also see that some letters are used more than once.  So this arrangement would fail both tests.

 

If there are 2000 words in my set of four letter words, that means there are 2000*2000*2000*2000 ways to arrange them.  That's 1.6x10^13.  If I wrote a program that analyzed one million arrangements per second(!!!), it would still take 185 days to run!  However, with some cleverness, we be a little smart about the arrangements.

 

One thing I immediately noted is that any word with repeating letters can be discarded from the start.  So, no more "WOOD" and "ICIY" and "BALL".  That left with me 1873 words.  That shaves some weeks off the runtime, but still, 100+ days is far too long.

 

If the top word is "ABEL", and the second word is also "ABEL", then there's no need to try all combinations of filling in the third and fourth slots with words.  I already know that no matter what is in the third and fourth row, the first and second row already break the "unique letter" test.  In fact, if the first word starts with "AB", then there's simply no need to try ANY A or B words in the second row, much less all the meaninglessness of filling in the third and fourth row.  So that gets rid of millions of iterations right there.

 

I've left this running for a few hours, and the top word has advanced to ALUM.  That puts me at about 2% complete after about 4 hours of runtime.  That's a bit more manageable, but is still going to take multiple days to run.  On my work computer, it's doing about 290K iterations per second.

 

*Update*

 

After writing all this, work pulled me away.  When I was done with that and spent some more time on the problem, I found two things.

 

First, the way that I was checking for letter uniqueness was pretty slow.  Just by making a few changes, my iterations per second went from 290K to about 650K.

 

Also, I found another little shortcut.

 

If the first word is ABLE and the second word is SPIT, then I'm eventually going to be looking for words that start with AS, BP, LI, and ET.  Do you think there are any four letter words that start with "BP"?  Me neither.  So I added some code that says this:  Any time the second word in the list is updated, check the word list to make sure that continuing down this path even makes sense.  That is, make sure that there are actually words that start with those letters.

 

This additional logic slows the iterations down a little, but pares down the number of cases that need to be checked by a quite a bit.

 

At the rate it's going now, I suspect it will be finished by the time I get into work tomorrow.  Which is really the point of this whole post.  Something that is really interesting about computer programming is taking a problem that seems overwhelming in it's scope, and thinking about it from different angles and coming up with ways to break it down into a more manageable size.

 

And even if there weren't any way to reduce the problem set down, this would be a great candidate for parallel processing.  I get a bunch of friends, and have them each run my program, but each friend only works on a distinct set of the problem (you get the set where the first letter is between A-D, you get E-M, etc).

 

I have to run.  Nerdy stuff, but fun.



2010/03/22

Allison's 2.5th Unbirthday

Allison is two-and-a-half!

 

For my future self, here's a little State of the Daughter address.

 

Allison is very bright.  She knows all her letters and their sounds, and is very interested in the first letter of words.  She'll frequently ask "What does apple (or whatever) start with?"  We encourage her to sound it out, and she frequently figures it out on her own.  It's a little tricky to explain that both Cinderella and cart start with a "c", and not "s" and "k" respectively.  She's also adept at solving problems.  She uses her little potty-step as a general purpose tool, moving it to new areas to reach things.  Diana took her to a gym class, where she was in a big pit of foam cubes.  The teacher called all the children to her (to get them to exercise by wading through the pit).  Allison instead exited the side of the pit and ran along the solid ground and sat down next to the teacher.  Clever girl.

 

Allison is very active.  Her favorite game by far is "Wait for Me", which we've renamed to "So Fast".  (I didn't like the main concept of the game to be disobeying what your parents are telling you).  The following sentence is heard on a daily basis:  "You and you sit on the green chair, and I run by, and you say 'Wait for us!'"  She enjoys running on the grass at the park, as well as the swings and the slide, and in particular swinging by her arms at the top of the slide.  She's very good at climbing almost anything.

 

Allison is independent.  She's not cuddly by any stretch, but will sometimes sit on our laps while watching a movie.  A notable exception was when she was sick, she would ask for cuddles.  In fact, I could tell she was feeling better when I asked if she wanted to lie with me and she refused.  If we try to help her with basic tasks like getting dressed or going to the bathroom, she sternly says that she can do it "All…. By… My… Self!"

 

In stark contrast to all this, though, is that she isn't very good at playing by herself.  She loves interaction, and has a hard time entertaining herself.  We'll set a timer for 10 or 20 minutes and tell her that we're busy until the timer goes off, and she needs to play by herself.  Sometimes this works, and sometimes she'll deliberately misbehave to garner some attention.

 

Allison is reserved around strangers.  She's improving in this regard, but she still keeps a wide berth around other kids at the playground.  Especially older boys who are loud and very active.  However, if approached by another kid, she can warm up quickly.

 

Allison is developing a sense of humor.  "Hey, watch this!" is a new favorite phrase, followed by some weird noise or movement, which is in turn followed by her examining us for our reaction.  She loves trying to make us laugh, or otherwise get our approval.

 

In contrast to the above, Allison also loves testing boundaries.  We'll tell her that it's time to do something (put on your shoes, etc), and she'll deliberately run away with a big grin on her face.  We'll give her a chance to do it herself, and she'll just stand there, staring as if to say "Yeah?  What are you going to do about it?"

 

Allison eats very well, and it's never big a big hassle to keep her fed.  She also sleeps very well at night, and is absolutely adorable at nighttime.  She'll sing and entertain herself in her crib for upwards of an hour before settling down and going to sleep.  (Only a few months ago, she would rely on calling us into her room as her entertainment).  Naptimes can be difficult on the weekends, but rocking her to sleep remains one of my favorite things.

 

She'll point out every bunny, Volkswagon Beetle ("BUG CAR!" she yells) and PT Cruiser that she sees.  She really likes the movie "Cars", and loves to hear stories about Mater and Lightening McQueen before bedtime.  She loves watching home videos of herself.

 

That's all I can think of for now, though I know I'm neglected thousands of details and nuances.



2010/03/14

Allison. Sick. Again.

I'm really starting to get frustrated by this.

On Saturday, Diana took Allison to her morning gym class, and then to Legoland with a friend.  The morning all went great.  They came home for a nap, and then I was going to take Allison out for the afternoon to give Diana some time to work.  We headed to the park and played for a bit, and then to the store.  It occurred to me, at that point, that Allison just didn't seem to be herself.  I got a very strong sense that something wasn't really right, although I'd be surprised if anyone else would have noticed.  A very strong case of parental intuition, I think.

We came home and took her temperature, and it was 102-something.  Ugh.  Some Motrin, and the evening went well.  She slept well over night, but woke up with a 103-104 temp.  Double ugh.  More Motrin, and a lazy day at home visiting with my parents, and lots of movie watching.

She's happy and in good spirits, but low energy.  The Motrin helps, but it's not the dramatic turnaround as the last time she was sick (two weeks ago.  Triple ugh).

We took her to an urgent care center, but they told us the wait time would be at least an hour and a half.  On top of the advice from the triage nurse on the phone (probably a virus, treat symptoms and let it run its course), we decided we didn't need to wait.

I think she's doing fine, but I'm really looking forward to the end of this string of sicknesses.  I'm not sure if that will be in the summer time, when viruses hibernate, or when she's 12 years old and finally has an experienced immune system.

I guess this is what two year olds are supposed to be doing, building up their immune system.  It's just frustrating, and not a little scary to see her so out of sorts.  It's also (and this is a really minor point) logistically a pain in the ass because her daycare provider (of course) won't take sick kids.  So Diana and I need to scramble to find childcare, take sick days, doctors appointments, etc.

Ok, thanks for letting me vent, blog.  Smell you later.

2010/03/11

XKCD Puzzle Example

Here was one of the more interesting puzzles from the book...

UATAQANUUNG QSICHINGNKUCHAANG CHSICHINGSICHINGNG SICHINGULUUNGUUNG CHAANGATAQANCHATAQANNG SICHINGULUUNGUUNG HSICHINGULUUNGATAQANM-SICHINGULUUNGSICHINGQSICHINGN NUATAQAN

I studied this one for a while.  You see lots of repeating sequences of letters (UATAQAN, SICHING, UUNG, etc).  I figured it might be a substitution cipher where groups of letters map to a single letter.  Like "UUNG" is "E", and QAN is "Y", or something.  I didn't get anywhere with that.

Someone else solved it.  Here's the answer.

The solution uses Aleut numbers.  Like, from the indigenous people of the Aleutian Islands.  How someone recognized this, I'll never know.  But lots of people know lots of crazy stuff.

http://www.unilang.org/wiki/index.php/Translations:_Numbers_-_Unangam_tunuu

Someone had the bright idea to find the Aleut numbers in the text, and substitute in the numeral.  So UATAQANUUNG reduces to U1UUNG (since ATAQAN = 1).

Likewise reducing the entire thing you get this:

U1UUNG Q4NKU5 CH44NG 47UUNG 51CH1NG 47UUNG H471M-474Q4N NU1

Now it's popular for the cool kids online to substitute numbers for letters sometimes.  1 is "L" and 4's kind of look like A's, 7's for T's, etc.  It's sometimes referred to as "elite speak", or just "leet" for short, or even 1337 if you're truly 1337.  (It's also popular to make fun of the cool kids online by imitating them, tongue-in-cheek).

If you're familiar with this kind of lingo, then it's pretty easy to read the above as:
ULUUNG QANKUS CHAANG ATUUNG SICHING ATUUNG HATIM-ATAQAN NUL

In Aleut, this is 7 3 5 6 4 6 11 nul

And translating into hex (all the other keys are in hex), you get this:  735664B0.

Simple, right?

2010/03/08

Exhilerating!

I'm totally pumped right now.

You know that geeky stick man comic that I occasionally post?  It's from a website called "xkcd.com".  Comics are published a few times a week, and they are typically very geeky math/science/physics/coding kind of stuff.  Usually funny, but sometimes romantic, heartbreaking, and introspective.

Around the holiday season, I noticed that he sold stuff.  Autographed strips, clothes, and so forth.  I bought a couple autographed prints (he adopted the Radiohead "name your own price model", which was pretty cool), as well as a book that was a collection of comics, a la Calvin and Hobbes.

In the book, to my surprise, were not only comics, but lots of fun little notes.  As well as puzzles.  Lots of things that looked like binary and hex and weird images and stuff.  There was clearly a treasure hunt hidden in the book.

There have been lots of puzzles like this.  Things are just kind of dropped on the public, and everyone kind of gathers online in a forum or something and works them all out.  I love this kind of thing, but I'm always late on board, so everything is always figured out by the time I even learn the thing exists.

So, by now, I figure the game is already over.  But I decided to work on some of the puzzles myself, and see if I can do it alone.  I solve a couple of the easier ones, but soon get pretty stumped.  Searching online, I see a forum where people have started posting questions and answers and solutions.  I cautiously read, trying to get hints without learning too much.  Soon enough, I throw caution into the wind and read the entire set of posts.

What I learn (and some of which I already knew) was that there is an encrypted message.  And to decrypt it, you need the key.  And the key has been divided into eight parts, and each part is a puzzle in the book.  So, solve all the puzzles, get the eight parts to the key, and decrypt the text.

By looking at the forum posts, the last post was about two weeks ago.  So far, it appears that seven out of the eight puzzles have been solved, yielding most of the key.  Some industrious folks started brute-force hacking to try to guess the remaining key (really just a number between 0 and about 4.2 billion), but apparently never succeeded.

So there was still some real work left to do!

The final puzzle was simply a little picture on a random page:



It kind of reminded me of a new-style UPC or barcode (like you might see on a FedEx package).  It also reminded me of some puzzles from the great game "The Fools Errand" (a must if you like puzzles).  In those puzzles, you removed some of the blocks, leaving others, and it finally spelled out a word, graphically.

Other people were doing what I did at first, which was convert the image into binary (where a 1 means a red pixel, and a 0 means a white pixel).  If you do that, you get this:


10111110101111110111111
11111111101011110100001
10111111111111111010100
11011001001001001010111
01100101011110100000001
01101110101100111111111
10111101011011110111110
01111111111010100100001
10111111111111001101111


The reason for doing this kind of conversion is that 1's and 0's can be used to create numbers, and numbers can be used to look up letters in a standard kind of lookup table.  So that approach makes some sense.

Now, there was one other piece of the puzzle.  There was a comic in the book that talks about factoring.  In the original online comic, the character talks about factoring a number into it's prime factors.  The book version is different.  In the book, the character uses a different number:  207.  207 is 3x3x23.  It just so happens that the image above has 23 pixels across and 9 pixels down.  So a connection is made there.

What I wanted to do was arrange the block of pixels into 3x3 blocks (23 of 'em).  To do this, I concatenated (joined) the first three lines, the second three lines, and the last three lines together.

101111101011111101111111111111110101111010000110111111111111111010100
110110010010010010101110110010101111010000000101101110101100111111111
101111010110111101111100111111111101010010000110111111111111001101111

Now I added spaces to make 3x3 blocks.

101 111 101 011 111 101 111 111 111 111 110 101 111 010 000 110 111 111 111 111 111 010 100
110 110 010 010 010 010 101 110 110 010 101 111 010 000 000 101 101 110 101 100 111 111 111
101 111 010 110 111 101 111 100 111 111 111 101 010 010 000 110 111 111 111 111 001 101 111


I wondered if something was written out.  I looked at the first block of 1's and 0's.  It kind of looked like a K.  The next one could make be an E.  The third was could be a Y!  KEY!  Holy fucking balls, I might have solved it!


I replaced 1's with X's and 0's with spaces:




X X  XXX  X X   XX  XXX  X X  XXX  XXX  XXX  XXX  XX   X X  XXX   X      XX   XXX  XXX  XXX  XXX  XXX   X   X
XX   XX    X    X    X    X   X X  XX   XX    X   X X  XXX   X           X X  X X  XX   X X  X    XXX  XXX  XXX
X X  XXX   X   XX   XXX  X X  XXX  X    XXX  XXX  XXX  X X   X    X      XX   XXX  XXX  XXX  XXX    X  X X  XXX


From there, I could read it.  KEY SIX OF EIGHT: D0E0C9A6

(I know this is hard to read.  I can't format it properly in Blogger, but it stood out very clearly in Notepad).

WOW!

Not only had I solved one of the keys, but I now was the only person in the world (as far as I know), who now knew ALL the keys!

I figured out how to stick all the keys together and decipher the text, and posted my results on the web forum for the world to see.

I know it's lame, but my heart was pounding when I read that final key and did the decryption work.  It was really exciting to have figured out the answer and post the results.

The final decoded message?  A date and time and GPS coordinates that correspond to the middle of Golden Gate park in San Francisco.  It's a Saturday in June, and I'm actually tempted to see if I could make it up there for the day...

Anyhoo, exciting stuff (for some definitions of "exciting" I suppose).

2010/03/02

Happy Ocean to You!

Allison made up a song.  She thinks it's really funny, which makes us crack up, which makes her crack up.  It's sung to the tune of "Happy Birthday".  The lyrics are pretty simple:

Happy Ocean to you!
Happy Ocean to you!
Happy Ocean to you!
Happy Ocean to you!

We have no idea where this came from.

Diana told me that Allison was talking about Bapa John's PT Cruiser recently.  Which is weird, because Allison knows what a PT Cruiser is, and Bapa John definitely doesn't drive one.  But Diana pressed a little, and Allison talked about Bapa John's PT Cruiser at the OTHER house.  Diana asked what other house, and Allison questioned back "Montana?"  But then Diana remembered that in Hawaii this summer, John's rental car was, indeed, a PT Cruiser.

Crazy kid.

2010/03/01

Knock on wood

In one of the Xmen movies, Wolverine gets shot in the head.  One of his X-man powers is super-fast healing and regeneration, and right before our eyes, we see the bullet wound close and heal.  I remember thinking how cool that was.  But I remember also thinking later how cool it is that our own bodies heal and regenerate, albeit at a slower (but still remarkable) rate.  So, speaking of which...

Little Allison was lethargic and feverish on Friday.  Absolutely burning up.  Friday evening and Saturday we kept her hepped up on Motrin, and that kept her feeling well and acting normal.  By Sunday, we didn't use any more medication, and she seems to have totally rebounded.  She's not allowed to daycare for a full 24 hours after having a fever, and we've passed that requirement.  The emergency grandparent contingent that we'd arrange for childcare today apparently is no longer needed.

I was even able to get away for a while on Saturday, up to the OC for Gabe's family birthday party.  It was nice to see everyone.  This annual event seems to have dual purposes lately, serving to both celebrate some Buhr birthdays, as well as a springboard for people to announce pregnancies.  Diana and I made our BIG ANNOUNCEMENT there three years ago.  Last year, it was Teri (rather, her growing belly speaking for her) that made a splash.  And this year, Iwan joined the club in announcing he and Sara would be joining the parenting ranks.  So a lot to celebrate that day.  I'm really happy for them... much more than I can express here.

Sunday morning I was out and about with Allison when I got the familiar migraine blind spot.  Ugh.  So we headed home and Diana took over while I holed up in bed for a few hours.  I was able to get up and watch the USA-Canada hockey game, which was really fun to watch until about 1 second before it ended.  Oh well.  I love my migraine medicine, but I really do feel pretty foggy for a good 24-48 hours.

So, overall, a real roller-coaster of a weekend.  I hope our adventures in illness are over for a while, and we can get back to a bit of a steady state.  It kind of feels like at least one of us has been sick since Thanksgiving.