Wednesday, February 10, 2010

Live Blogging from SPTechCon

I’m here in San Francisco live blogging for at SPTechCon (#SPTechCon).

I’m currently in the SharePoint developer workshop being run by Phil Wicklund. It’s a full day overview of SharePoint development.


Wednesday, February 03, 2010

SharePoint Game of Life

I’m sure some SharePoint community folks will remember John Conway’s Game of Life population simulation (cellular automaton) from comp. sci. For my SharePoint 2010 Enterprise Metadata Management (EMM, or taxonomy) talk at SharePoint Saturday in New York last weekend, I decided to create my own version for testing the performance of the new SharePoint taxonomy API.

Update: I have posted the source code for the SharePoint Game of Life web part on CodePlex. If you’re interested in SharePoint taxonomy, you can also check out my blog series on Enterprise Metadata Management (EMM).

Using the rules of the Game of Life, I created a SharePoint 2010 Visual Web Part that creates a new taxonomy term for each organism spawned during the simulation. When the creature dies, the term is deleted from the term store.


- SharePoint Game of Life running a glider

I actually did this back in 1999 for the NCompass Resolution Publishing API (the software that eventually became Microsoft Content Management Server), so I also had an interesting exercise of porting ASP script to C# code. The SharePoint Game of Life web part tracks the number of terms created and the time it took to run. I’m planning to use this web part as a sample for a SharePoint 2010 book project.

Here are the rules of the game (from Wikipedia):

  • Any live cell with fewer than two live neighbours dies, as if caused by under population.
  • Any live cell with more than three live neighbours dies, as if by overcrowding.
  • Any live cell with two or three live neighbours lives on to the next generation.
  • Any dead cell with exactly three live neighbours becomes a live cell.
  • The most famous pattern in the game is called a glider. This pattern is interesting because over iterations, it will simply continue to move across the grid. The glider configuration has been adopted as the hacker emblem.


    - the glider starting position

    For dramatic effect, I decided to add an image for a dead organism—as you can see in the animation. This isn’t normally done, so for the Game of Life purists, I’ll probably add an option to disable it in the release version of the code.

    The code isn’t ready for prime time yet, so I don’t have perf numbers to publish yet. But hopefully, I’ll get a chance to polish it up soon.

    BTW – The creature is an homage to Mazogs. A ZX-81 (Timex Sinclair 1000) game I played as a kid.