Starbeamrainbowlabs

Stardust
Blog

Coding Conundrums Evolved 2: Binary Biomass

This post is part of a biweekly series of programming problems, targeted at those learning to program using C# at University. The problems will vary in difficulty - some will be rather easy, and some will be quite challenging! Don't worry if you can't solve a problem just yet - come back to it in a few months and it'll seem a lot easier than it did before.

Welcome back to Coding Conundrums Evolved, my take on Rob Miles' original Coding Conundrums series. Last time we built a translator for an alien language. As promised, you can find my solution to that problem here. The password to the archive is eyamporrean. In episode 2, some scientists have made an amazing discovery.

The ISS (Above: The ISS as seen from the Space Shuttle Atlantis when departing from the station.)

The scientists on the Zirros orbital research station have managed to create a brand new species of tree (which they've decided to call the mikoko tree) in their lab that grows in precisely the same way every time, allowing the number of leaves on a tree to be predicted with accuracy months or even years in advance.

Upon hearing about this new discovery, the engineering department of Zirros immediately designed a biomass generators a that runs on the leaves of the mikoko tree, since they have been having issues with the station's solar panels recently.

A mikoko tree growing.

The mikoko starts with a single shoot, which splits into 2 every 9 days. Every time the shoot splits in two, all the previous joints grow a cluster of up to 3 leaves. A joint may not hold more than 3 leaves at once. Incredibly, the mikoko doesn't actually need any of its leaves to grow. It can perform all the photosynthesis it needs to in its branches, apparently. Furthermore, the shoots on the mikoko can be snipped off, at which point the tree ceases to grow any further. In this state it still produces the clusters of leaves every 9 days. The scientists have performed various experiments and come to the conclusion that a single leaf produces 1.5 energy credits when burnt in one of engineering's new biomass generators. The Zirros station, according to engineering, uss 56 energy credits per day.

It is anticipated that once the scientists' paper is released on the mikoko, every station / spaceship / colony within 25 light years will want to power themselves very own mikoko farm. Doing the calculation to work out how big of a tree is needed for each installation is boring and time consuming, and so you've been asked to write a program that will do the calculations needed to work it out automatically.

Given the number of energy credits a station uses per day, write a program that will calculate the day on which a mikoko tree should be snipped such that it will produce enough leaves to produce enough energy to power the station in question. The following stations have already issued requests:

Helpful Hints

Challenge

The scientists have also found that you can plant 5 leaves together, and a new mikoko shoot will grow after 3 days. Alter your program so that it takes this into account when reporting the day that the mikoko trees should be snipped. Make your program also report the days on which leaves should be taken from the existing tree(s) and planted to create new trees.

As per last time, my solution can be found here, and the password will be released with the next challenge.

Update: The next post has been released! Find it here: Fiddly Fuel. The last post was Alien Encounter

Tag Cloud

3d account algorithms announcement archives arduino artificial intelligence assembly async audio bash batch blog bookmarklet booting c sharp c++ challenge chrome os code codepen coding conundrums coding conundrums evolved command line compiling css dailyprogrammer debugging demystification distributed computing downtime embedded systems encryption es6 features event experiment external first impressions future game github github gist graphics hardware hardware meetup holiday html html5 html5 canvas interfaces internet io.js jabber javascript js bin labs learning library linux low level lua maintenance network networking node.js operating systems performance photos php pixelbot portable privacy programming problems project projects prolog protocol protocols pseudo 3d python reddit reference release releases resource review rust secrets security series list server software sorting source code control statistics svg technical terminal textures three thing game three.js tool tutorial tutorials twitter ubuntu university update updates upgrade version control virtualisation visual web website windows windows 10 xmpp

Archive

Art by Mythdael