37 lines
776 B
Plaintext
37 lines
776 B
Plaintext
int SDown, SLast, SNone;
|
|
|
|
proc Tree(Root, Head);
|
|
int Root, Head;
|
|
int Col(2), Tail, R;
|
|
def \Stem\ Str, Next;
|
|
[Col(Str):= 0; Col(Next):= 0;
|
|
Tail:= Head;
|
|
loop [if Tail = 0 then quit;
|
|
Text(0, Tail(Str));
|
|
if Tail(Next) = 0 then quit;
|
|
Tail:= Tail(Next);
|
|
];
|
|
Text(0, "--"); IntOut(0, Root); CrLf(0);
|
|
|
|
if Root <= 1 then return;
|
|
|
|
if Tail # 0 then
|
|
if Tail(Str) = SLast then
|
|
Tail(Str):= SNone;
|
|
|
|
if Tail = 0 then [Tail:= Col; Head:= Col]
|
|
else Tail(Next):= Col;
|
|
|
|
while Root do \\ make a tree by doing something random
|
|
[R:= 1 + Ran(Root);
|
|
Root:= Root - R;
|
|
Col(Str):= if Root # 0 then SDown else SLast;
|
|
Tree(R, Head);
|
|
];
|
|
Tail(Next):= 0;
|
|
];
|
|
|
|
[SDown:= " |"; SLast:= " `"; SNone:= " ";
|
|
Tree(8, 0);
|
|
]
|