Christmas Challenge 2021
************************

Author: BeebMaster (www.BeebMaster.co.uk)

System: BBC Micro & Master 128

Language: BBC BASIC (BASIC 4r32 used)

Length of code: 80 bytes tokenised BBC BASIC, 113 bytes text

How to run: Done on real hardware, but this link will run it in an emulator:

https://bbcmic.ro/#%7B%22v%22%3A1%2C%22program%22%3A%220CLS%3AVDU8%3AW%3DPOS%2B1%3ACLS%3AT%24%3D%5C%22ACEGCGKOEKQWCC%5C%22%3AFORB%3D1TOLENT%24%3AL%3DASCMID%24%28T%24%2CB%29-64%3APRINTTAB%28%28W-L%29%2F2%29STRING%24%28L%2C%5C%22*%5C%22%29%3ANEXT%5Cn%22%7D

Description: Essentially uses string manipulation to do mathematical calculations.  I often do programming this way.  Therefore, the tree is stored as a string with one byte representing the number of stars for each row. Originally I had planned to do this using hex digits, but some of the lines are more than 16 characters long, so instead I used ASCII codes to represent the number of stars which allowed each line of the tree to represented by a single byte.  Also I interpreted the requirement to centre the Christmas tree on screen to mean auto-centre, so this program will centre the tree no matter what the current screen mode's column width (as long as it is wide enough).  It's also short enough to be a "one-liner".

Detailed description:  Clear screen then backspace.  This puts the cursor at the final column of the preceding line, the value of which is held in the BBC BASIC system variable POS.  Add 1 and store in W, so W now contains the width of the screen.  Clear the screen again.  Declare the "byte-map" of the tree into T$.  Start a FOR...NEXT loop and get the ASCII code of each character in T$ in turn into L, and deduct 64.  This is the number of stars for that line.  Tab to the centre point of the screen, which is (W-L)/2, and print, using the BBC BASIC function STRING$, the number of stars in L.  Loop round till the end of T$.

18/xii/2021
