Pages

Sunday, March 31, 2013

Masking & red cabbage dyeing Easter eggs

Easter eggs dyed with red cabbage

This year we colored Easter eggs with red cabbage juice. The patterns were made by masking the eggs with washi tape and candle wax.

Straining red cabbage

To extract the color from red cabbage, I boiled slices of five large leaves in water with some vinegar, for roughly 30 minutes, then removed the cabbage leaves by straining, and allowed the dye to cool. On the right is a piece of cotton string we boiled with the cabbage. It turned a very nice purple, I'm hoping the dye will stick to it.

Covering eggs with washi masking tape

To get patterns on the eggs, we covered some parts of them with washi masking tape. We also used molten candle wax, applied with a small paint brush.

Easter eggs soaking in red cabbage dye

The eggs were soaked in the cabbage dye for a few hours.

Dyed Easter eggs

Rinsing and removing the masking tape. The color is a nice blue, even though the cabbage was red and the dye purple! Red cabbage juice works as a pH indicator; it turns red when acidic and blue in alkaline solutions (and can even turn green or yellow for strong alkalines). It seems there is some chemistry going on in the shells.

The masking tape worked well - it kept the dye off the masked parts of the egg. Where two stripes of tape crossed each other an unexpected effect appeared: the upper stripe did not mask the egg perfectly just where it passed the lower stripe, giving an illusion of depth in the final pattern! The lines on the egg that appears to pass below another line were created where the tape stripe passed above another stripe.

The painted-on candle wax gave nice artistic effects!

Dyed Easter eggs

The finished eggs. Happy Easter to everyone!

Friday, March 15, 2013

Favourite Games: Widelands

widelands buildings
Widelands - a strategy game where you build up your civilization and defend it from your enemies. The best defense may well be striking first. Widelands is an open source game, and is said to be similar to Settlers II. The game is still evolving, but is already very enjoyable.

The game contains a complex economy, with different types of goods and buildings that produce goods or process goods from one form to another. In fact, building and then maintaining a working economy is the main part of the gameplay. There is also fighting with your neighbors, of course, but the battles take place with a minimal input. The only real choice is what to attack, and when to do it.

Widelands mines
Each warrior needs an axe. Axes are made in an axe factory using iron and coal. Iron is made by combining coal and iron ore in a smelter, these two resources one gets by constructing a mine at a suitable mountain site. However, the miners work only when they are well fed, which requires bread, meat, or fish, prepared into meals in a tavern. Every item produced is transported along roads between the buildings, so having an efficient road network in necessary for a productive economy. When the flow of wares becomes too much for the carriers, one can breed oxen for use as pack animals.

I like building my empire more than I like fighting the other players, so it suits me fine that the game emphasizes construction over battles. It feels nice to construct an efficient system of factories. In the game I played while writing this post, I ran out of wood in the beginning and then all construction projects ground to a halt. I had a small border battle with my green neighbor, but that war fizzled out when we both ran out of fighters. Then I lost some time before constructing an axe factory, since I believed it required a master blacksmith (which it doesn't). Another thing that caused trouble is that upgrading a building wastes all resources in it. (To save them, one has to order the stores to be emptied before upgrading. This problem is discussed on the bug tracker.) My greedy neighbors left me alone for quite some time even though my defenses were very thin, but eventually they defeated me by burning down my head quarter and storage. I'll get them next time though.
Widelands headquarter destroyed

There is a bit of a learning curve for this game, it takes time to find out how the wares should flow between the different buildings. There is some in-game help, in the form of a tutorial game and a list of all wares and how they are produced. The game music is quite monotonous. Because of it, the game is locally known as the meeh-meeh game. In all other respects, a great game! There is a multiplayer mode which I have not tried, but it sounds like great fun.

If you feel brave, try out the development version. The current development version, in preparation of release 18, still has some rough edges, but also notable improvements over the last stable release (17). The graphics is nicer and the colors have improved a lot. They were very saturated before, but are calmer now.


The Favorite Game series

Thursday, March 7, 2013

Red Snail Missing


I recently found a box of my childhood favorite candy, the 'Frog butterfly snail' ones - every eighties kid from Finland knows which ones I mean.

As a kid, it was always important that the box contained at least one candy of each of the ultimate correct types: red butterfly, yellow snail, and green frog. I'm happy to report success in the present case! In fact, the only combination missing from the box I bought was a red snail.

Monday, March 4, 2013

Fractures and Fractals



A wintry day I saw cracks in our parking lot asphalt with salt crystallized around the cracks. The patterns looked nice and reminded me of fractals, and gave a nice topic for a small Processing program.

Move the mouse over the picture to see different patterns! Click to zoom in, right-click to zoom out.



This is a drawing of the Julia set. Moving the mouse changes the (complex) parameter of the fractal. If you middle-click, you see a picture of the Mandelbrot set. There is an interesting and beautiful connection between the Mandelbrot and Julia sets, which we will get to after a very brief description of how the fractals are drawn.

Both fractals are drawn by iterating a complex function: \[z_{n+1} = z_n^2 + c.\] Starting with a value \(z_0\), one can use the equation over and over to find a long sequence of \(z\)s. The fractals are images of the complex plane, where each point is colored depending on how the sequence \(z_n\) behaves. Depending on \(c\) and on the staring value \(z_0\), the magnitude of \(z_n\) either stays bounded or explodes when \(n\) grows. If the sequence explodes, the color is chosen according to how many iterations it took for \(|z_n|\) to become larger than some suitable constant.

For the Mandelbrot fractal one always starts with \(z_0 = 0\), and choose \(c\) according to the point one wants to color. In the Julia fractal, \(z_0\) is the complex coordinate of the point you want to color, while \(c\) is a parameter of the fractal kept fixed for the whole image. Moving the mouse cursor over the image above changes the parameter \(c\).

The connection between the Julia and Mandelbrot fractals is this: The parameter \(c\) of the Julia fractal corresponds to one point in the image of the Mandelbrot set. When \(c\) is inside the Mandelbrot set (the central area traditionally colored black), the corresponding Julia set is connected. Try different points! It seems that the Julia set keeps the looks (the curlyness and fuzzyness) of the place one chooses in the Mandelbrot set. Points at the edge of the Mandelbrot set tend to be the most interesting.

While drawing this fractal, I learned that the color map is the key to getting nice pictures. It took some tweaking to get a nice-looking result. Coloring by the logarithm of the iteration count seems to be a good idea. You can have a look at the fractal source code here. Finally, one can choose some other complex function to iterate. Simply changing \(z^2\) to \(z^3\) or \(z^4\) gives interesting results.