Function Kata „Christmas tree“

Write a function that „draws“ a Christmas tree with ASCII characters (ASCII art). The „picture“should be returned as a collection of strings. See the following example of a tree with height 5:

Christmastree.Draw(5)
X
XXX
XXXXX
XXXXXXX
XXXXXXXXX
X

Variation #1
The Christmas tree may have a star at the top:

Christmastree.DrawWithTop(5) or Christmastree.Draw(5, true)
*
X
XXX
XXXXX
XXXXXXX
XXXXXXXXX
X

Level of difficulty

Code Kata Categroies

Share This