O Tannenbaum
December 24, 2013
Merry Christmas to all my readers.
Your task today is to write a program that draws a Christmas tree on the screen; it can be as simple or elaborate as you wish. When you are finished, you are welcome to read or run a suggested solution, or to post your own solution or discuss the exercise in the comments below.
In haskell, a nice little christmas tree.
http://codepad.org/14SQwTia
Hacked up version in Go.
http://play.golang.org/p/uNUoCadnLT
Merry Christmas!
After looking at other entries I feel I should have tried to spruce it up a bit ;).
http://codepad.org/oMKIX4Fx
ConPHPigurable Tree:
$rows = array(1,3,5,7,9,11,13,15,17,20,25,31,2,2,2);
$cp = $rows;
sort($cp);
$wi = $cp[count($cp)-1];
$char = “*”;
foreach ($rows as $c) {
$buff = round(($wi-$c)/2);
print str_repeat ( ” ” , $buff );
print str_repeat ( $char , $c );
print “\n”;
}