scene.org File Archive

File download

<root>­/­parties­/­2021­/­vintagecomputingchristmaschallenge21­/­challenge/felix_nardella_c64_basic_vc3-2021.zip

File size:
5 374 bytes (5.25K)
File date:
2021-12-25 12:55:52
Download count:
all-time: 16

Preview

  • felix-tree.bas 176B
  • felix-tree.diz 1.90K
  • felix-tree.png 2.38K
  • felix-tree.prg 151B
  • felix-tree.txt 178B

file_id.diz

**********************************************
* Vintage Computing Christmas Challenge 2021 *
**********************************************
Author: Felix Nardella
System: Commodore 64
Language used: BASIC v2
Length of source code: 176 byte
Length of executable file: 151 byte

Instructions on how to run the code:
I used the VICE 3.5 emulator (https://vice-emu.sourceforge.io/). To run this program you need to install the VICE and then drag and drop the prg file into it.

Complete source code:
1 a$="**":b$(0)="*":fori=0to2:forx=1to4:b$(x)=b$(x-1)+a$
2 a=len(b$(x-1)):b=20-a/2:printspc(b)b$(x-1):next
3 b$(0)=b$(0)+"**":a$=a$+"**":next:fori=0to1:printspc(18)"***":next

Description of how the code works:
a$="**":b$(0)="*" : ............ Initializes the variable a$ and array b$()
fori=0to2 : .................... Start the cycle to draw the 3 parts into which the tree has been divided
	forx=1to4: ................. Start the cycle to draw the 4 lines of which each part of the tree is made
		b$(x)=b$(x-1)+a$ : ..... Updates the b$() array that contains the number of * of each row of each part of the tree
		a=len(b$(x-1)) : ....... Variable a contains the length of the line that corresponds to the number of *
		b=20-a/2 : ............. Variable B contains the number of spaces to be calculated for each row of *
		printspc(b)b$(x-1) : ... Print the spaces and * of each line
	next: ...................... Increase x; End of cycle
	b$(0)=b$(0)+"**" : ......... Update the number of * contents of the first row of each part of the tree
	a$=a$+"**" : ............... Update the number of * to be added to each row after the first of each part
next : ......................... Increase i; End of cycle
fori=0to1 : .................... Start the cycle to draw the end of the tree
	printspc(18)"***" : ........ Print 18 spaces and the 3 * in the center
next: .......................... Increase i; End of cycle