The trees we are growing have some rules that define how they grow:
- Trees consist only of branches.
- Branches are made up of a combination of the following symbols:
A tree starts as a single vertical branch/trunk (
|) on the ground (
The food for branch growth comes from light.
- Light starts at an intensity of 2 at each point in the sky and travels straight down.
- Each branch is able to eat half the light available to it and the rest passes through to lower branches.
- Thus, a branch with no other branches above it will get 1 unit of light-food each season, a branch with 1 branch above it will get .5 units of food each season, and in general a branch with n branches over it will get 1/(2^n) units of food each season.
- At the end of each season, the food is totaled starting with the trunk and moving up and converted into new branches and fruit (apply the following rules until the branch turns into fruit or has less than 1 unit of food remaining):
- If a branch has less than 1 unit of food at the end of a season, all the food for that branch is stored in that branch until the next season.
- If a branch has greater than or equal to 1 unit of food and has room to grow, it randomly grows a new branch using the available growth patterns (see below) and stores the remaining food for the next season.
- If a branch has >= 1 unit of food, nowhere to grow, and has offshoot branches, it evenly distributes the food to its offshoot branches
- If a branch has >= 1 unit of food, nowhere to grow, and no offshoot branches, it becomes fruit (represented by
- Here are the possible growth configurations
_ \ | / _ _ \ | / \ | / _ | | | | | \ \ \ \ / / / / __ \_ |_ _| _/ __ --- Vertical Branches --- --- Diagonal Branches --- --- Horizontal Branches ---
Example potential tree:
\ / / \/O |___// \_/ \//O\_/ \__/|\|_/ \|/ __________________|__________________
Your program should be able to take as input a list of which snapshots of the tree you would like to see. For example [10,20,50] would mean you'd like to see the tree after 10 seasons, 20 seasons, and 50 seasons.
For each input season, your program should output the season and then a picture of the tree in that season. If it helps, you can define a maximum age for the tree, such as 60, so that the maximum height for a tree would be 61, and the maximum width would be 121, and then always show the tree on that scale. Otherwise, feel free to scale your image to any sized tree. For example, if the input was [0,1,2,3], your output might be:
Season 0: _|_ Season 1: \ __|__ Season 2: _ \| ___|___ Season 3: |_/ _ \| ____|___
Each solution must post the output of the coder's favorite run of their program with input of
[10,40], along with their source code. Also, ALL the above criteria must be met in order to qualify.
The winner will be the qualifier with the highest number of votes.
Good luck and merry planting!!!