Christmas tree in qbasic/qb64
I ported my Christmas tree code to qbasic/qb64. Works with Qbasic in dosbox and QB64PE
```
DECLARE SUB DisplayTree ()
DECLARE SUB DisplayMessage ()
DO
CLS
DisplayTree
DisplayMessage
FOR delay = 1 TO 3000: NEXT delay 'Replace this line with sleep 1 in QB64
LOOP
SUB DisplayMessage
year = VAL(MID$(DATE$, 7, 4)) + 1
COLOR 7
PRINT SPACE$(5); "MERRY CHRISTMAS"
PRINT SPACE$(5); "HAPPY NEW YEAR "; year
PRINT SPACE$(5); "Press CTRL+BREAK TO EXIT"
END SUB
SUB DisplayTree
DIM colors(3) AS INTEGER
colors(0) = 4 ' Red
colors(1) = 10 ' Light Green
colors(2) = 1 ' Blue
COLOR 2
PRINT SPACE$(17); "*"
randomColorIndex = INT(RND * 3) ' Randomly select an index from 0
stars = 3
FOR i = 0 TO 17
IF i <= 14 THEN
spaces = 14 - i + 1
COLOR colors(randomColorIndex) ' Set the text random color
PRINT SPACE$(spaces); "o";
COLOR 2
PRINT STRING$(stars, "*");
COLOR colors(randomColorIndex)
PRINT "o"
stars = stars + 2
ELSE
' Print the tree trunk
COLOR 2
PRINT SPACE$(14); "######"
END IF
NEXT i
END SUB
```
#programming #dos #dosbox #qb64 #qb64pe #qbasic #xmas #christmas #christmas2024 #basic