Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- : spc 32 ;
- : half ( n -- n/2 ) 2 / ;
- : rep ( c n -- ) 0 do dup emit loop drop ;
- : top ( width -- ) cr dup 3 rot 2 mod - + half spc swap rep '* emit ;
- : line ( width index -- )
- cr dup rot 2 + 2 / swap - spc swap rep
- dup 2 * 1+ 0
- do
- dup 3 / i + 4 mod 2 - 0= if '0 emit else '^ emit then
- loop drop ;
- : ctree ( width -- )
- page
- dup top
- dup 2 + 2 / 0 do dup i line loop drop
- cr ;
- 21 ctree bye
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement