Monday, November 28, 2005

Artificial Life

About 3 or 4 years ago I was tinkering with writing an artificial life simulation. The idea was to use genetic algorithms with some fairly simple heirarchy of rules for behavior, such as, if object x is a certain distance away, then do action y. The behaviors would be randomly generated, so you could get really strange behaviors like, if a a piece of food is 5 or less spaces away, then move toward the nearest hiding place. Plus, each creature would have a list of these rules to evaluate in order, and that order would also be randomly determined in each creature. The program would evaluate each rule in order until a mathcing condition and action was performed. If no rule matched, then the creature would just sit there.

The creatures would initially be randomly generated each with its own set of rules, however the creatures had the ability to reproduce with other creatures, in which case the offspring would get a mix of the rules from the parents. It might take 1/2 a rule from one part and half a rule from another parent, so if parent X had the rule, "If food is less than 5 spaces away, move towards the nearest hiding place" and parent Y had a rule, "If hiding place is less than 10 spaces away, move away from the sun", the offspring might end up with a rule that says, "if hiding place is less than ten spaces away, move towards the nearest hiding place." Then, the offspring would actually have a potentially useful rule that generated "hiding behavior".

To make things interesting, the creatures needed to eat, and if they didn't, after a certain amount of time they would die. Also, the creatures could attack each other, and the only source of food was the dead bodies of the creatures. It was hoped that over a long amount of time, there might be some sort of behavior that evolved that might produce a group of creatures that could live a long amount of time.

So, in a bit more detail, the random rules were basically made up of a specific structure:

If X is {less, greater} than Y, then Z.

Choices for X could be a hunger value, an object (such as food, another creature, the sun, a hiding place, the edge of the world, etc.).

The choice of "less than" or "greature than" was also randomly selected.

Y could be any numeric value from 0 to 100.

Action Z could be things like "attack nearest creature", "move away from", or "move towards", or "eat", etc.

I've over-simplified a bit of the rule format, but hopefullly that explains enough of the details. The goal was to have rules that could easily be randomly generated, and that had a fixed structure so they could be spliced together to form simple types of behavior.

Did it work? You can be the judge. You can download the program here. Unpack the zip file into a folder and run the program life.exe. One caveat - the program is a bit CPU intensive when it runs, especially if the creature populations start to grow. If you notice things slowing down, hit ESC to exit the program. NOTE: this is Windows program. It won't run on a Mac. Sorry. At some point, if I get some free time, I might make a Java version that can run in a web browser.

Here's a screen shot of what the program looks like when running. A static image looks kinda boring - it's definitely more interesting to see the real thing in action. The creatures move around quite quickly.



In the center of the world is a sun which has gravity. Orbiting the sun are some red spheres that act as cover or hiding places for creatures. All the little colored dots are the creatures. The tiny tiny dots (only visable if you click on the screen shot for a larger view) are dead bodies. Any creature in a red sphere can not be seen by any other creatures. If a creature touches the sun, it dies and is removed from the world. The idea of adding a sun with gravity in the center or the world was to provide an automatic "clean-up" mechanism to prevent the world from getting overpopulated with dead bodies or creatures that just sorta sat around reproducing and eating their offspring. With gravity, such creatures will eventually get sucked into the sun, unless they have a behavior that tries to avoid the sun.

Anyhow, feel free to play with it. I find it kinda relaxing to just watch the creatures run around for a bit. It's sorta like watching a fish tank. Here's an example of what happened when I let the thing run over-night. Eventually, some sort of successful life form developed and took over the world. I really ought to add a feature that would allow displaying the rules of the creatures that successfully developed.

Sunday, November 27, 2005

Quabbin Reservoir


Today a friend and I made a visit to the Quabbin Reservoir. The original goal was to do some kayaking and possibly spot some bald eagles. The reservoir is a known area for spotting bald eagles, so it seemed like a good idea at the time. Unfortunately, after a 2 hour drive to get there we discovered that due to some very strange policy, they don't allow canoes or kayaks on the reservoir. Now I could understand this policy if all boats were forbidden, since it is a reservior for drinking water, but that isn't the case. They allow gasoline power boats for fishing - they just don't allow environmentally friendly boats such as canoes, kayaks, or even sailboats. Quite odd.

Anyhow, regardless of that bit of disappointment, we still had a good time. The reservoir area is a beautiful place.

Since we couldn't go kayaking, we decided to instead do some hiking in hopes for seeing some eagles. We never did see any eagles, but we did manage to come upon a pair of white-tailed deer on a trail. Unfortunately, I made the mistake of not having my camera out and ready (it was in my backpack) so I didn't get to take a picture before the deer ran away. That's one lesson I have now learned. Whenever I go hiking, I should have my camera ready. After the deer ran away, we spent a while stalking them through the somewhat snowy woods, trying to get a chance for a decent photo. After about a half hour of circling through the woods trying to flush the deer back towards my friend who was waiting with his camera, this photo was the best I could manage.

Saturday, November 26, 2005

Lots of Protein

 This Thanksgiving, my sister and brother-in-law got to talking with me about protein. Since I am a vegetarian and they know I take a lot of karate classes they were wondering whether I was getting enough protein. As it turns out, my sister had just bought a 96 ounce bottle (that's six pounds!) of some sort of protein shake mix. Add a small scoop of this stuff to just 5 ounces of water and you get a chocolatey 22 grams of protein. Both my sister and brother-in-law claimed to not like chocolate (Weirdos! Who doesn't like chocolate??) and they said they bought the chocolate flavor by mistake, so they offered the big bottle to me. I was a bit skeptical about how good something could be that says "Tastes Great!" on the label - and also something that uses the term "Instantized". I mean, is that even a real word? But I hid my suspicions and accepted their generous gift.

And what do you know? The stuff really does taste great! I've heard lots of horror stories about protein drinks tasting chalky or just plain gross, but this stuff tastes very good. And who can argue with 22 grams of protein? And it's instantized! I still have no idea what that means, but it must contribute to the good taste in some way. And speaking of "way", this protein is whey protein, which comes from milk. So if you don't approve of drinking milk, then you might want to stick with soy-based protein. But, if it's just a lactose concern, from the description on the bottle, it appears they claim the lactose is removed by "ultrafiltration and diafiltration". Hmmm.... are these more made up words?

In any case, if you are looking for a high protein drink and don't mind goofy marketing words on the bottle, I give this a thumbs up! The only potential drawback is the huge size of the bottle (note the book in the picture above for a sense of scale). The bottle is slightly bigger than a basketball, albeit a slightly squished basketball. And there aren't many places in my kitchen where I can easily fit a slightly squished basketball.

My Friend Orion

 
Ever since I was a kid, the Orion constellation has been my favorite. It's probably because it's the one I can spot most easily. This time of year, it becomes my faithful companion in the eastern sky. Each night as I drive home I see it out the side window of my car. And when I turn out the lights at night to go to sleep, I can glance out the window and see it. There's something comforting about it - perhaps because in this world of impermanence, it's something I know will always be there. In the big picture nothing is permanent - the sun and moon and everything else will eventually go away - but at least on the small scale of my lifetime, I'm pretty sure I can count on Orion being there.

Friday, November 25, 2005

A Very Happy Thanksgiving

Thanksgiving is by far my favorite holiday. There are no expectations for gifts or anything like that. It's the one major holiday that is just about getting together with family and being appreciative (i.e. thankful) for this thing called life. And yesterday was a very happy Thanksgiving day for me.

This year's Thanksgiving was at the home of one of my sisters - about 2 hours from where I live. Fortunately, I had company for the drive - I picked up my niece and nephew along the way and we listened to two new albums I had just purchased - one a "best of" by The Beautiful South and another was some Celtic music by Loreena McKennitt. Sadly, there was a bit of snow on the highway and on a couple occasions we did see a few cars that had spun out and were in the process of being rescued by tow trucks and state troopers. Hopefully for those folks their day turned out better than it started.

My sister lives in Topsfield, Massachusetts - a very old New England town. Before dinner, a few of us took a walk to a nearby historic house - the "Parson" Capen House, buit in 1683. In the house they had some people in period dress who were talking about what life was like back in the 1600s. They also served us cider and popcorn. The house had a huge fireplace and also an interesting looking oven.


In the town commons area, there was a stone monument to honor some local residents who had unfortuntely been victims of the witch-hunts of the 1600s. Sad stuff.


Back at my sister's house, some people were watching a dog show on TV. Oddly enough, even my sister's dog Lewis was interested in the show.

A group of us ended up playing a very fun board game before dinner. It's called Compatability. You split up into teams of two and each team member has an identical deck of cards with photos on them. A topic card is then randomly chosen which will have a word on it (such as "science fiction", or "failure", or "guide") and everyone will then select 5 cards that they think best match the theme word. You then compare the results with what your partner selected and get points for each match. There's lots of funny interaction as you try to figure out the reasoning behind some of your partner's picture choices.

Dinner was the usual Thanksgiving selection for my family - turkey, mashed potatos, stuffing, string beans, corn, broccolli casserole, rolls, and cranberry sauce. Even though I'm a vegetarian, I always feel I should at least try a small piece of turkey on Thanksgiving. I don't really like turkey, but for some reason I haven't quite thought out, I feel I should try it this one day a year.

After dinner, three of my young nieces put on a short show for the family. They had spent a lot of time in the morning preparing for it. They even set up a small "theater" with reserved seats for all the guests and a funky sequin carpeted aisle for people to walk down.

The theme of the show was Thanksgiving and consisted of little skits and poems. My nieces even gave out awards to people at the end of the show - such as one for thanking my sister for preparing the meal, another to one of my other sisters for appearing to be the most thankful for being invited to the show, etc. Heck. I even got two awards later in the afternoon. (If you can't read the small print, one award is for funniest singer and the other is for funniest dancer. I offer no explanation for why I got those. You'll have to use your imagination.)

After the kids show, some of us played a rousing game of Time's Up! It's a team game where each person tries to get their partner to guess a name on a card. The names range from celebrities, to famous people in history, to fictional characters. Since some of the names might be obscure for kids (and a couple of my younger nieces and nephews were playing) we decided to take a few minutes before the game and think of our own "kid friendly" names to write on index cards. The game is played in three rounds - the first one you can say as much as you want to get your partner to guess the name. The second round, you can only say one word (but can also use sound effects and pantomime). The third round you can't say anything - you can only use sound effects and pantomime. What makes this game fun is the unexpected word associations and actions people will perform trying to get their partner to guess the name in later rounds. I still get a chuckle out of the image of my mom (who is in her mid-sixties) falling on the floor acting out having a house fall on top of her. She was trying to get someone to guess "Wicked Witch of the West", but we all just thought she must be pretending to have some sort of seizure. (And yes, for the record it was really the Wicked Witch of the EAST who had a house fall on her...)

While a group of us was playing Time's Up!, another group was playing Bausack, a very fun block stacking game.

After the board game silliness ended, then my family's true strangeness started to show. An acoustic guitar happened to be out in the living room, so a few of my nephews decided to have an improptu blues session. One nephew played the typical blues beat on the guitar while my other nephews wailed about their troubles in life. Lots of hilarity ensued as people would occasioanlly interrupt lines like "I got an F on my paper" and explain that that's not really a sad enough topic for the blues. So then we had slightly better attempts with lines like "My pet pig Arnold left me...." As I said, my family is strange. And if a blues jam session wasn't enough to top off a Thanksgiving day feast, what followed definitely was. My brother-in-law broke out the sheet music for some Beatles amd Paul McCartney music and began to play some tunes while other family members sang along. The night ended with everyone dancing and singing to a crazy rendition of "Twist and Shout". Even my dad - at the age of sixty nine - was seen doing an air guitar. Here's a picture that captures the moment pretty well.



Even the drive home with my sister, niece, and nephew was fun. Key highlights were having a fairly lengthy karate discussion with my sister and later breaking out into a sing-along to "If I had $1000000" while listening to a greatest hits album by the Barenaked Ladies. (And for those out of the music loop, no - there are no ladies in the band, and no one is naked - it's just a silly band name.)

All-in-all, it was a very happy Thanksgiving. It made me realize how much I love my family, even if they are a bunch of crazy people. :-)

Thursday, November 24, 2005

Sunrise

 I never seem to get bored of seeing a nice sunrise. :-) I can't remember whether in the next few weeks the sun will be so far south on the horizon that from my window I won't get to see it rise anymore. I hope not. I guess I'll have to wait and see. In either case, at least the amount of daylight will start getting longer in about a month and the sun will start appearing further north again. 

Sunday, November 20, 2005

Tastey Gem!

 Ever since I was a kid, I have loved eating pomegranate ftuit. It's a nice treat because it seems they are only available in the grocery store for a short time each year. It's hard to describe what it tastes like - it's sweet and sour and bitter all at the same time. If you haven't tried it before, get to the store soon - they are only available September to January. Just be aware it's a bit of work trying to eat them. The skin of the fruit is somewhat leathery, so it's hard to peel. Also, the edible part of the fruit are little juice sacs (called arils) which are easy to pop, getting red staining juice everywhere. Here's a good reference for how to get at the arils more easily. Enjoy! 

Note: the aril pictured above is much bigger than actual size. I got my camera really close to it when I took the picture.

Friday, November 18, 2005

Dalai Lama in Rare Rhode Island Visit

As his last stop while in the US, the Dalai Lama gave a speech at Salve Regina University yesterday. A story from the Providence Journal describing the event can be found here. Note, like many newspaper web sites, this link may require a free registration to view it. Sorry.

Here's a short excerpt from the article:

During his talk, he outlined the steps that can lead humanity to peace. It begins with each person being more compassionate.

"Once a more compassionate attitude develops," he said, "then it's very easy to communicate with others."

Once the "inner self"' becomes more sensitive and compassionate, then "inner peace" will follow. Inner peace will spread to families and then, he said, "the whole community becomes more passionate." As this attitude spreads, so, too, will peace.

"World peace will be achieved through inner peace," he said.


Surprisingly, the Projo also has an MP3 file of the complete speech available for free download. NOTE: this mp3 file is over 100 meg in size!!! The recording is approximately one hour and 15 minutes long. The first 2 minutes and 45 seconds is just background music and intermittent applause. The actual speech starts shortly after that.

What the hike?

I took half the day off from work today to get a few things done. I ended up with a bit of unexpected free time late in the afternoon. It was a very nice bright sunny cold fall day, so I decided to take a short hike near where I live. I walked out to Rome Point. I hadn't gone there in a while on foot (I usually paddle out there via kayak) and was pleasantly surprised to see the town has finally added a small parking lot at the entrance to the trail. No longer do people have to take the risk of parking on the side of a busy road. It used to be especially dangerous in the winter with snow banks leaving very little space to park.

Rome Point is a wooded area off of Route 1A in North Kingstown. There are quite a few trails that meander through the woods with some going by old foundations, stone walls, etc. - i.e. it's typical New England woods. But what is atypical about this place and what makes it somewhat popular is it borders the ocean and is adjacent to the West Passage of Narragansett Bay. So, you can hike through the woods for a bit and then go for a walk on a rocky beach. And, the biggest draw is from November to May you have the chance to see harbor seals on the rocks off the point. (NOTE: you'll really need to bring binoculars to best see the seals.)

The actual hike to the beach is pretty short, although I managed to dilly-dally with my camera and binoculars making the round trip about and hour and a half. It's funny, I live within walking distance of this place and I haven't gone here for a hike in about 6 months. I had forgotten how nice and peaceful it is.

This is the view to the left when you first arrive at the beach. Off in the distance is Rome Point.


To the right you get a nice view of the Jamestown Bridge. In front of the bridge is also the Plum Beach Lighthouse, which I have paddled out to in my kayak in the past.

While walking the beach, I came across this weathered section of wood. It makes for a nice bench to just sit and enjoy the scenery.



Parts of this beach were covered with seashells. The piles where at least a foot deep in some places! I'm not really sure what type of creature used to live in this type of shell, but there sure were a lot of them around here.


Along the trail going out to the point, there are some signs warning about the seals. The signs seem to imply that the seals might be right on the beach, although I've never seen them there. They have always been on the rocks about 100 yards off the shore.



Here are the rocks off the shore and you can barely make out the seals on the rocks. (Click on the photo for a larger view.)

Here's is the best I could get with the zoom on my camera. Still it's hard to see the seals. That thing on the right that looks like a rock is actually a seal sitting on a rock that is just below the surface of the water.


While watching the seals at the point, I noticed this HUGE ship going up the bay. I have no idea what it was. I've never really seen anything like it before. Here's a close-up of what it looked like.


And here's a picture zoomed out to get a sense of how big it was. (You might need to click on this picture to get a slighter larger view.)


Whatever it was, it was being followed by a tug boat. Maybe to make sure it didn't get stuck anywhere.

After watching the seals and the mystery boat for a while, I noticed it was starting to get dark, so I headed back. In this picture, you can see the old mill building I live in off in the distance. It's close to a full moon and was low tide, so the water in the cove was mostly gone. Six hours from now and the water will be quite high.

Wednesday, November 16, 2005

More Toys

 I just got some new weapons for kobudo - tonfa! Like most traditional Okinawan kobudo weapons, these were originally used for a more utilitarian purpose. In this particular case, the tonfa were originally designed as handles for turning a grinding wheel.

I'm now learning the kata "Matayoshi No Tonfa Ichi". I must admit, when I first started using the tonfa they felt incredibly awkward - probably the most awkward thing I've tried to do in karate so far. Someone even pointed out in the first class I started using the tonfa that I was sticking out my tongue while practicing - it took that much concentration for me. Thankfully, after a couple weeks it now feels a lot more comfortable. I'm pretty sure I'm no longer unconsciously sticking out my tongue. :-)