Rebol
With a dialect to display the symbols. To change the tree size, just change the parameter of make-tree
.
make-tree: func [int /local tr] [
tr: copy []
length: (int * 2) + 3
repeat i int [
repeat j 3 [
ast: to-integer ((i * 2) - 1 + (j * 2) - 2)
sp: to-integer (length - ast) / 2
append/dup tr space sp
append/dup tr "*" ast
append tr lf
]
]
append/dup tr space (length - 1) / 2
append tr "|"
append tr lf
tr
]
print make-tree 3