October 28, 2009

Conway’s Game of Life (in Java)

Just recently I’ve become interested in Conway’s Game of Life. Basically it’s a set of rules governing the life cycle of cellular automata. Even more basically it’s a 2D grid where the number of living cells around another cell decide whether it lives or dies (or comes to life).

For example: imagine a chess board. Now pick a square. If that square has fewer than 2 living neighbours (the 8 surrounding squares) then it either stays or becomes dead, as if from lonliness. If it has more than 4 living neighbours then it dies, as if from overcrowding. If it has exactly 2 or 3 living neighbours and is already alive then it stays alive. If it has exactly 3 living neighbours and it was dead then it becomes alive.

And that’s it. But because it plays out over many turns (or iterations) it allows for certain patterns to repeat, or entire formations to move across the grid as cells become dead or alive in turn.

Anyway, my fascination with this led me to write a small Java game of life simulator. I’ve provided the code here

It’s not good or tidy code, but it might interest you if you’re a starting programmer.

Game of Life with 3 Gliders

Game of Life with 3 Gliders

An interesting shape to start off with is the glider (O is dead, X is alive):

OOX

XOX

OXX

put that in the top left and it will move diagonally down and right.

Experiment and have fun :)

Filed under: musings
Tags: , ,
komakino @ 10:34 pm

October 6, 2009

Annoying Facebook Users

From my own Facebook experience, I’ve noticed there seems to be a small but recurring cast of characters that serve only to annoy everyone else with their status updates.
Some of these may have come up on other lists on other sites, but that’s just coincidence and these are based on my own observations of my own facebook wall.

1. The “Latest update report on my new baby / puppy / kitten” person.
We get it, you’re proud of the new addition to your family and you’re keen to show it off, but do we REALLY need to know that this little bundle of joy / bag of fur “enjoyed his breakfast this morning!”? And do we really need three thousand new yet almost identical pictures of the tiny, bloated pink thing? No one is as interested in your baby or pet as you are. When we’ve seen it once we’ve seen it a thousand times.

2. The “mysterious” one.
You know the type – always fishing for you to ask them what their status means. Usually something along the lines of “Mel doesn’t know what to do…” or “Well! That didn’t end up as expected!”, just trying to tempt you into asking “Oh, what about?” or “What’s happened?” so they can bore you and everyone else with the details, yet make it look as if YOU asked THEM to talk.

3. The faux cry for help.
I’m sure everyone’s got one of these on their list. Every update is a variation on “Jen just wants to end it all” or “What’s the point in anything?”. Often combines well with number two to be both an irritating cry for help and a line to reel in the well wishers.

4. The girl who plays every single game and takes every single quiz.
So much so that her only status updates are her new high scores, who her ideal partner would be, which movie it is she’s most like, how compatible she is with Darth Vader and how fast she can name the capitals of the world. You wonder how this person gets on in life given that they seemingly spend 90% of the day taking quizzes on facebook. In the late 90s this is the person who would have sent on those god-aweful email chain letters asking you about your love life (or lack thereof) and warning you that if you don’t send it on to 10 people the consequences would be dire. DIRE!

5. The habitual drunkard.
Often, but not always, a college / university student, their only updates are to tell the world that either last night was a great night because they’ve never been that drunk, or that last night was so great they can’t remember what happened. And this happens every night.

6. The constant campaigner.
This is the person who only posts to invite you to join groups campaigning against some-or-other perceived injustice or cruelty somewhere around the world. Well meaning but naive, this person genuinely believes that a facebook petition is going to prevent drought in Eritrea or drug running in Laos.

7. The one who spells or punctuates appallingly.
I know this will rile some with cries of ‘Grammar Nazi!’, but there’s one on every list (or several, if you hang around with a pack of complete drongoes) who has no idea how to spell or use punctuation. Sentences like “…fink’s u realy need 2 gt out wiv more peep’s” show the both common misconception (amongst truly stupid people) that you need an apostrophe every time a word ends in ’s’, and a total inability to spell basic words like a functioning member of society. People who write like this and aren’t below the age of 9 should be shot.

komakino @ 10:13 am

Older Posts »
x