Allegro.cc
Projects
 Action 252 Adventure 22 Arcade 216 Board Games 30 Demos 24 Emulators 10 Other 68 Puzzle 139 Role Playing 40 Sports 25 Strategy 58 Utilities 46
Resource Directory
 Code Gallery 3 Compilers 12 Help & Documents 13 Libraries 63 Media 2 Tools 8
IOTD: Chickens - An adding machine that runs off duck's eggs
Chickens - An adding machine that runs off duck's eggs, by Andrei Ellman

Chickens is a Puzzle-game where the Chickens have to be guided through a spaghetti junction of pipes (by changing the state of the interchanges) to the end of the level while avoiding the evil ducks. The Chickens can lay eggs in up to four different colours which must be guided to the right incubator for their colour to hatch into a new chicken, but the ducks can lay eggs too.

One interesting property of certain interchanges is that if an object is travelling underneath, the interchange changes state for the duration that the object is passing underneath. This gives the pipe-maze the property of being able to emulate logic gates [en.wikipedia.org] from which digital circuits [en.wikipedia.org] can be constructed.

In the level depicted in the image, an adding-machine has been constructed by chaining a half-adder [en.wikipedia.org] and three full adders [en.wikipedia.org]. This gives us a machine that can add two four-bit values and produce a five-bit result. The two inputs are at the top, and the output is at the bottom. In both the input and output pipe-clusters, the least significant bit is always the rightmost bit, and the most significant bit the leftmost bit. To solve this level, certain binary numbers must be passed to the output to unlock the gateways required for completing the level in order to let chickens pass through or prevent ducks from passing through.

In order to clarify what is going on, the various pipes have been coloured. Red pipes feed the various components a steady stream of duck's eggs in order to power them (VCC). The blue pipes are like data-paths, and the green paths are used to dispose of unwanted ducks' eggs (GND). Black pipes are used for other purpouses (although static interchanges and Nearby-Object-Controlled Interchanges are always black). The skulls are dead-ends that dispose of any object trying to enter. They glow for a short while if something touches one.

The black interchanges remain static, but if a red pipe is underneath, the interchange is a Nearby-Object-Controlled Interchange that changes state while something remains underneath. The red pipe glows if it is active (which means that something is inside it and the interchange is in its changed state), and is dark-red if inactive (the interchange is in its natural state). The light-green interchanges can be changed by the user by moving the mouse over them and clicking to change its state. The light blue interchanges change state every time an object tries to enter one.

The tap on the left feeds the level with chickens, and the taps at the top feed the level with ducks' eggs.

The solution to this level is as follows: At first, there is a super-duck out to get the chickens. This duck must be killed before it can do any harm. To do this, it must be guided to the skull at the left-end of the topmost row of gates. In order for that to happen, the adder must produce a sum of nineteen. Note that to allow time for the propagation delay of the circuit, the paths of the chickens and the duck can be lengthened by changing the state of two interchanges close to where they start out. Once the super-duck has been defeated, the chickens must pass through the same set of gates to the nest so they can lay eggs. For this to happen, each bit of the output result must be inverted. This means selecting two numbers that added up produce twelve. Once through, they find abandoned superhero-costumes. They grab hold of them and change into super-chickens. Super-chickens can move 1.5 times as fast as regular chickens, can lay eggs much quicker, and will be invincible in any fight (unless it's with a super-duck). In this picture, you can see some super-chickens on the bottom of the screen near the nest. They look like ordinary chickens, but they are wearing leather jackets and sunglasses. The pipes near the nest with red and blue exits mean that eggs and fowl (chickens or ducks) exit through different paths if they enter the neutral path. Fowl exit by crossing the red line and eggs exit by crossing the blue line. After the chickens have passed the first set of gates and before they start laying eggs, the second set of gates must be opened to enable the eggs to pass to the incubators. This requires a twenty-seven. The eggs are now directed towards the four incubators in the bottom-left of the screen. The player must then use the interchanges to guide each egg to it's correct colour incubator for it to hatch into a new chicken. The incubators use smiley-faces to indicate how close to hatching an egg they are. The more complete the smile (which ends with the incubator opening it's mouth), the closer it is to hatching an egg, which exits through the mouth as a newborn chicken and the mouth fades away. The number on the incubator indicates howmany eggs are inside the incubator, and the bar to the right of the incubator indicates how full it is. Once a sufficient number of chickens have been hatched, they should traverse the bottom-most row of gates to get to the exit. This requires the adder to produce twenty-eight (note that because twenty-eight is just one more than twenty-seven, this number can be obtained by adding one to one of the inputs. This changes the values of three bits in the output). However, there is still a hazard. The area near the exit is patrolled by an army of ducks and a single super-duck (wearing sunglasses and a leather jacket). This will mean that unless the super-chickens who have been laying the eggs are unleashed on the ducks, the newly hatched chickens are doomed. The super-chickens can be unleashed using two interchanges for a two pronged super-chicken attack. Once the ducks have been wiped out, the chickens are then free to leave the exit on the right edge of the screen. The number on the exit-square is used to show howmany chickens need to get to the exit in order to complete the level.

Chickens comes with an integrated level-editor so that you can design and play your own levels.

The graphics were drawn by Dennis Busch.

This is only a pre-release version of chickens, so expect some improvements in the future.

Chickens is available for DOS, Windows and MacOS X (the MacOS X build is currently experimental). An experimental dynamically linked version for Ubuntu Linux is out there as well. A fully statically linked Linux binary will be comming soon.

Happy egg-laying...
Oh dear, the image is full of JPEG artifacts. To see it in it's lossless glory, see http://allegro.cc/depot/screenshots/3137_large.png - Andrei Ellman
It looks so crazy that I'm too scared to try.
Now you only need to add musical-emitting pipes (like piano keys), and you can design a level that plays a symphony. - Audric
A statically linked 32-bit Linux Binary is now available. - Andrei Ellman

Really good game. I am going to make levels.

- Striker

The lossless image URL mentioned above no longer works. It is now at http://static.allegro.cc/image/project/screenshot/4076_large.png

- Andrei Ellman
This section is only available to registered Allegro.cc members.