loge.hixie.ch

Hixie's Natural Log

2004-12-15 23:05 UTC Evolution is a fact

I occasionally run into people who say things like "evolution is only a theory, it might not be true!".

Imagine you are in a normal room, on Earth, and you have two identical drinking glasses, both full of water. You pour the contents of one glass into the other glass.

I'm sure everyone agrees that the result will be a lot of water all over the table and floor!

Nobody disagrees that this would happen, because you can try it, and guess what, every time you try it, the same mess results. Same with concepts like "fire gives off heat": You can quite easily walk up to any fire and sure enough, you heat up.

I imagine that people's problem with evolution is that they don't have first-hand experience with it, and therefore don't believe it happens in the same way that they believe in over-filling a glass or fire being hot.

I wrote a program when I was a kid that simulated evolution to make little characters on the screen walk from one side of the screen to the other. Each character had a short DNA consisting of random instructions moving it up, down, left or right, and for each "generation" I used the two most successful characters' DNAs to randomly generate new DNAs, with a little mutation thrown in.

It worked very well, and with a few tweaks I was even able to make the characters evolve into walking particular paths, etc. So I have no doubt that evolution is a fact.

Writing a program to do this is not everyone's cup of tea, though, so here's a simpler way to model evolution that everyone can do, and which shows just how effective it is.

To do this, you'll need 20 coins (or anything with two well-defined sides which can be made to randomly pick one).

Each coin represents an organism. In our little model, organisms have just one "gene", whose value is determined by whether they are face-up or face-down. (In reality, organisms have hundreds or thousands of genes, but let's stay simple here.) Initially, the gene has no effect on whether the organisms live or die.

For simplicity, we're going to say that the life-cycle of a coin is as follows: They are born, they grow up and possibly die, the survivors randomly separate into breeding pairs, each breeding pair has two or more children (as many as can fit the environment), then the parents die and the cycle continues with the children of the new generation.

If the parents are both heads-up, then the children will all be heads-up, if the parents are both tails-up, then the children will all be tails-up, if the parents are mixed then the children will be randomly mixed as well. Occasionally, a mutation occurs, and a child of a heads-heads pair is tails-up, or a child of a tails-tails pair is heads-up.

This is a very simple version of what happens in real life, but like I said, we're going for simple here.

Ok. Throw the twenty coins into the air and let them land randomly on a table. This represents the first generation.

This generation, they all live. Pair up your coins randomly, and let them all have two children according to the rules listed above (which basically means leaving the pairs as is). This is your second generation.

If you feel like it, randomly flip some of the children over to represent mutations. Separate out the coins again so that you don't breed the children with each other for the next generation (it doesn't matter all that much if you do, but it gives you a better feeling for what is going on if you don't).

If you did it right, then you should have twenty coins, some heads-up, some tails-up. You can repeat this process several times, nothing particularly interesting should happen. The fraction of coins that are heads-up vs tails-up will stay roughly the same throughout.

Now we introduce a change to the environment. For the next generation, any coins that are heads-up will die. This is equivalent to saying that there is a genetic aspect that has suddenly become important to survival. For instance, maybe there is now a new predator in the environment that eats heads-up coins but leaves tails-up coins alone. (Something similar happens with moths and their colour.)

Look at the children — er, coins! — that are on the table now, and push any that are showing heads to the side. This represents the coins that died while growing up.

Now, pair up the remaining coins.

Make the pairs breed. Since you have a few spare coins now, some of the breeding pairs can have three or four (or more!) children instead of two. Use up all the "dead" coins in this way. Breeding pairs that are both heads-up would get a heads-up child, breeding pairs that are mixed would get a randomly flipped coin, etc. To represent mutations, flip a few coins over.

Separate the coins out again. Look at your coins, comparing it to what you had just one generation ago.

That's evolution.

For extra credit, you can repeat the process the other way around. Have a few generations where heads-up coins die, then have a few generations where the side doesn't matter, then have a few generations where tails-up will die.

You can also try to change the environment violently from tails-up-dies to heads-up-dies and seeing what happens. If you're doing mutations with each generation, then your coins will probably scrape through (and then begin to thrive again), but without mutations, you'll just wipe out your entire coin population.

Pingbacks: 1

2004-12-15 05:05 UTC Nocturnal

I accidentally set off the flat's smoke alarm at 05:20 today. I didn't even know we had one. Usual story — a little smoke from heating an oven that contained a little cooking oil at the bottom of a tray that I hadn't noticed, which the cooker's overhead fan wasn't strong enough to pump out.

Blimey that thing was loud. I nearly had a heart-attack. Unsuprisingly, it woke at least one of my flatmates. I guess that's a good thing, in a way, since it is designed to do that. But still. Suggestion: There could be a way to pre-emptively turn off a smoke alarm situated near a kitchen for a limited time when you know that you're about to let out a lot of innocuous smoke.

Ironically the whole event quite put me off my food.

Earlier I finally finished Neal Stephenson's Quicksilver, which I've been reading for a while. Usually I just zip through books but this one was some pretty heavy (though rewarding) reading. Now I'm starting on The Confusion, which is the next one in the series.

2004-12-14 23:53 UTC Finished as well

I got to see the San Andreas end credits today, so theoretically that means I finished it. I'm actually at 62% completion.

2004-12-12 22:20 UTC Empire building and bean growing

Today I went to play board games with some people again.

First we played four-player Blokus. Simple quick game whose goal is to put the most blocks on a grid while following some placement rules. Great game to get started. No randomness!

Next we played a seven-player 7 Ages. We played for five hours and got about one seventh of the way into the game, so I'd have to classify this as a long game. It's a quite complex game compared to games I'm used to. I wasn't overly impressed. (The long game we played last week, 1856, was much more fun.) It had a lot of pieces, many of which served multiple purposes, and a big flimsy map, upon which you're expected to stack dozens of little tokens into tiny countries. I've noticed that for me, board games in which pieces frequently slide around are less enjoyable than those where the pieces click into place and stay firmly where you put them. You spend so much time fixing things and trying to keep piles from falling over that it detracts from the fun. Also, this game had more randomness in it than a strategy game like this should have (that is, it has randomness at all!).

Finding good games to play with more than four players is not as easy as finding good four-player games, but eventually we decided on a third game: a six-player Bohnanza (with the revised version of the first expansion). This game is all about trading beans so that you can grow the biggest crops and sell them for the most value for money. I loved this game. It's easy to get the hang of it, and it has my favourite game feature: well-defined interplayer trading as a key game component. With six players the trading was very active. The key to most trading games is to let other people know what you have to give and what you want, so that the less aggressive traders can trade with you. Otherwise you'll only end up trading with the loud ones, and so your options will be much more limited. Like most card games this one has an element of randomlness, of course, but that is partially offset by the trading aspect.

Finally we played a six-player Alhambra, a board-and-card game where you have to build a town by buying pieces using four different resources. An ok game.

In other news, the WHAT working group released a second (and probably final) Call For Comments for the Web Forms 2.0 draft proposal. This call for comments is your opportunity to help the WHAT working group make the spec perfect. If you don't send your comments now, then you will have no right to complain if you don't like the spec later! This includes if you agree with comments people have already sent to the list — it isn't rude to send redundant comments, indeed when the CSS working group was going through CSS2.1 Last Call, we found it very useful to know which issues were issues that just one person was worried about, and which issues multiple people felt strongly about.

Pingbacks: 1

2004-12-06 00:51 UTC Choo choo

Today I met some new people and played some games. First we played a game that took seven hours, namely 1856, one of the games in the 18XX series. I lost, but based on reading sites about this series of games, apparently I should expect to lose my first ten games and get a middling result for the next ten. So I'm not too worried. I was within a factor of ten of the winning amount...

Then we played Ricochet Robot, which I did slightly better at. That's a surprisingly mind-melting game.

Finally we played Munchkin, Star Munchkin to be precise. I love that game, it's just too funny.

The problem with Munchkin, in my opinion, is the randomness. The main thing I loved about 1856 is that there is basically no randomness involved. The only thing in the entire game that is outside the control of the players is the starting order, and in fact even that could be solved by allowing the players to bid for their places somehow. Similarly with Ricochet Robots: all the randomness affects the players equally, so everybody gets an exactly equal chance of winning.

Games with high randomness, on the other hand — like Munchkin, Killer Bunnies, or Monopoly — reduce the influence of skill a lot. You can be an expert Monopoly player and still get screwed by the die and lose, or you can be an expert Munchkin player and simply not get any monsters to attack.

Killer Bunnies (or rather, to give it its full title, "Killer Bunnies and the Quest for the Magic Carrot") gets around this problem by admitting straight off the bat that the winner is random. Basically the game consists of an hour of trying to kill each other's bunnies, and then suddenly you ignore 95% of what happened earlier in the game, and randomly one player is picked as the winner. You can only affect who wins by increasing your chances of being a winner, either by (effectively) buying more lottery tickets or disqualifying another player altogether.

Munchkin is similar, although the randomness isn't anywhere as explicit in the game mechanics.

Both are hugely enjoyable though, and we've got every expansion available. The difference is that these games are much more about the having fun than the result.

Kam and I have been considering writing our own card game. We're currently arguing about exactly this issue. I'm arguing that the game should have built-in protection against the randomness favouring one player, by making every card be both a "good" and a "bad" card and requiring that players balance their "karma" so that they have to use skill to work out which cards to use on themselves and which to use on their opponents. He's arguing that the whole point of the card game should be that it is mostly random.

In other news, we watched the first episode of Stargate: Atlantis in detail yesterday. If you don't want to be spoiled, stop reading now. We were wondering, having seen the more recent episodes (in particular, say, episode 13 "Hot Zone") exactly how many people they had sent to Atlantis. Our thinking was that we would then be able to count the number of deaths over the season and be able to identify in which episode they'd run out of "red shirts" altogether. We never got around to counting the number of people (although we did establish that you should theoreticaly be able to estimate a roughly accurate number), because before we got as far as twelve people, we found a discrepancy. After Sheppard and his team comes through the wormhole, eleven items have crossed the event horizon. In order, they are: a MALP, Sumner, three unidentified airmen, Weir, Ford, Sheppard, three more unidentified airmen. So one MALP, ten people.

However, if you count the items actually in the Atlantis gate room just after those last three airmen have gone through, you'll see twelve people.

Where did the extra two people come from?

We didn't miscount. We checked. Several times. In slow motion, in fast motion, with a chipmunk audio track, and with freeze frames. Yes, I have no life, so sue me.

Several explanations (other than the boring one, "oops", which I'm sure will be the one on the director's commentary!) come to mind. My personal favourite is that the Reole, featured in the SG-1 episode "The Fifth Man" (season 5 episode 4), reached Atlantis before the Humans and will form a mysterious source of extra red shirts when the plot requires more people to die. Since the Atlantis team has no contact with anyone who has an independent way of verifying how many people are on the team, there's not really any way they could tell anything was going on.

Assuming the Reole don't have the Ancient Gene, they wouldn't have triggered any of the Ancient technology, and could therefore have lived there for some time without causing all the power drainage that the Human team caused within minutes of arriving.

Another possible answer is that the Pegasus-class stargates aren't completely backwards compatible with the Milky Way-class stargates and some of the people coming through got cloned. Seems unlikely though, since they would probably have found out about that relatively quickly.

Or maybe two of the people in the shot are actually ascended Ancients looking over the place and trying to blend in by taking on the rough silhouette of gun-toting nosy humans. That would also explain the way they move about very quickly between some of the shots.

In other news, I finished the last Salsa class of this year and signed up for the second course which starts in January. I really enjoyed it, much more than I expected, and look forward to the next set of lessons. Incidentally, having just googled for some of the things I've learnt in those classes, I'm glad it turns out I'm not the only one who heard "cross-bodily" when his teacher was saying "cross body lead". At least I can chalk it up to the fact that these lessons are in Norwegian so I'm having to guess as to what he's saying most of the time anyway...

Now, back to writing up a draft of the card game rules Kam and I are inventing.

Pingbacks: 1 2