A blog about the development and usage of GarlicSim, the open-source Pythonic framework for computer simulations.
Written by Ram Rachum, developer of GarlicSim.

GarlicSim Website

Twitter

GitHub Repository

Ram's Personal Website

27th December 2010

Text

The crunching widget: Changing world rules on the fly

Last week I released GarlicSim 0.6, and one of its big features is the new “Crunching” widget. In this post I’ll explain what the Crunching widget is and what it’s good for.

This is the first mock-up I did for the crunching widget:

I made this mock-up in a notebook while I was hiking in Makhtesh Ramon in April 2010; That was about 8 months ago. And now here’s the actual working widget, that I released last week:


(Shown here on a Mac; Since it’s written with wxPython, it’s completely cross-platform and uses native widgets on each operating system.)

The crunching widget allows you to control how your simulation gets crunched. Let’s review what it does from top to bottom:

The autocrunch control

The autocrunch control is the most straightforward one:

It allows you to change how big of a buffer GarlicSim computes for you. For example, if you go to a world state with a clock of 27, GarlicSim will automatically crunch the simulation until it reaches a state with a clock reading of 127. This is so you could hit play and have the simulation play back immediately, without having to wait for it to crunch.

So in the autocrunch control you can change how far GarlicSim will autocrunch, and you can turn off autocrunching entirely.

The step profiles control

This is a more interesting widget. It allows you to manipulate step profiles.

A step profile is a set of world rules to be used in a simulation. For example, if you’re doing a simulation in Physics, you have a bunch of world rules that the simulation adheres to. Forces are computed according to various constants, and then the acceleration is computed by using F = m a. These are the world rules for your simulation. And by using a different step profile, you can use a different set of world rules in the same simulation. For example, do you want to see how your world would look like if you’d change the gravitational constant? Or use a different equation instead of F = m a, so you could switch between Newtonian Physics and Special Relativity? You can do it all by using a different step profile.

Since there isn’t a Physics simpack yet, we can’t see how it applies to Physics; But we can see how it applies to Conway’s Game of Life. We can specify different birth/survival numbers and see how our new cellular automaton behaves:

And now let’s see our new grid:

This grid looks inherently different from normal Life grids, because it was created by different world laws.

The cruncher control

The cruncher control shows which cruncher type is being used and allows switching to a different one on the fly while simulating:

Here’s the dialog you get when you press “Change…”:

Feedback?

I’ll be happy to get feedback and criticisms on this new widget! Download GarlicSim, play with the crunching widget, and let me know what you think!

Comments
All content in this website is copyright © 1986-2011 Ram Rachum.
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License, with attribution to "Ram Rachum at ram.rachum.com" including link to ram.rachum.com.
To view a copy of this license, visit: http://creativecommons.org/licenses/by-sa/3.0/