Towards Christmas

Hello,
just in case you need it, here is a Christmas thing that uses the 2.2 console (ahem).

Happy new year to Rebol Tech. and all others ML people.

Ciao,
Daniele.

REBOL [
    Title: "REBOL Christmas"
    Author: "Daniele Forsi"
    Email: [EMAIL PROTECTED]
    Date: 17-Dec-1999
    Needs: 2.2
    Comment: "Needs some polishing"
]

levels: 5    ; change this for overall size

dup: func [ s [string!] n [integer!] /local i r ] [ r: copy "" i: 0 while [ i <= n ] [ 
i: i + 1 append r s ] r ]

light: []

first-branch: 1
prin [ "^(page)^(9B)0 p" ]
print rejoin [ dup " " levels * 2 - first-branch "X===" ]
line: 1
for level 2 levels 1 [
    for branch first-branch level * 2 - 1 1 [
        print rejoin [ dup " " levels * 2 - branch rejoin array/initial branch * 2 - 1 
"*" ]
        line: line + 1
    ]
    print rejoin [ dup " " (levels - level) * 2 - 1 rejoin [ "o" rejoin array/initial 
level * 4 - 1 "*" "o" ] ]
    line: line + 1
    append light reduce [ line (levels - level) * 2 + 1 level * 4 ]
    first-branch: level * 2 - 1
]
for level 2 levels 1 [
    print rejoin [ dup " " levels * 2 - 2 "###" ]
]
print "REBOL Christmas to everybody"
print "by Daniele Forsi ([EMAIL PROTECTED])"
print "(press any key to stop)"

lamp: "o"
until [
    wait random 4
    light: head light
    lamp: either lamp == "o" [ "O" ] [ "o" ]
    foreach [ line row1 offset ] light [
        prin rejoin ["^(9B)" line ";" row1 "H" lamp ]
        prin rejoin ["^(9B)" line ";" row1 + offset "H" lamp ]
    ]
   input?
]
prin [ "^(9B) p" ]
;eof

Reply via email to