VCCC2023: Christmas Challenge
- dominicbeesley
- Posts: 2212
- Joined: Tue Apr 30, 2013 12:16 pm
- Contact:
Re: VCCC2023: Christmas Challenge
Did you enter those rtw? I didn't spot them in the video...I thought I'd got the third smallest BASIC program but evidently not.
I have up optimising when I got to 53 bytes which is &35... seemed nice and symmetrical.
I have up optimising when I got to 53 bytes which is &35... seemed nice and symmetrical.
Re: VCCC2023: Christmas Challenge
10a=2858:b=2602:FORX=8TO20STEP6:FORY=8TO20STEP6:VDU31,X,Y,a;a;a;b;b;b;7978;X,Y,b;b;b;a;a;42:NEXT,
84 bytes. I like it but I failed in my hopes of being less than twice the smallest. Although I am not twice the size of the smallest BBC basic which is a relief
a is asterisk, cursor up. b is asterisk, cursor down and 7978 is asterisk, 31. I thought the use of the semi-colon syntax to send two bytes was quite nice and saved a few commas. I could've centered it but that might've increased it by a couple of bytes.
I like yours RTW , I'll have to do the maths to figure it out.
https://bbcmic.ro/#%7B%22v%22%3A1%2C%22 ... T%2C%22%7D
84 bytes. I like it but I failed in my hopes of being less than twice the smallest. Although I am not twice the size of the smallest BBC basic which is a relief
a is asterisk, cursor up. b is asterisk, cursor down and 7978 is asterisk, 31. I thought the use of the semi-colon syntax to send two bytes was quite nice and saved a few commas. I could've centered it but that might've increased it by a couple of bytes.
I like yours RTW , I'll have to do the maths to figure it out.
https://bbcmic.ro/#%7B%22v%22%3A1%2C%22 ... T%2C%22%7D
Re: VCCC2023: Christmas Challenge
I'm afraid David Payne's BBC BASIC entry was 41 bytes See time 35:33 in the video
- dominicbeesley
- Posts: 2212
- Joined: Tue Apr 30, 2013 12:16 pm
- Contact:
Re: VCCC2023: Christmas Challenge
I've just tried having a go using all the combined hindsight available and I can't beat David's 41 in BBC BASIC...can any one else....there must be a byte to be had somewhere but I can't see it!
Re: VCCC2023: Christmas Challenge
I can...dominicbeesley wrote: ↑Sat Dec 30, 2023 11:00 pm I've just tried having a go using all the combined hindsight available and I can't beat David's 41 in BBC BASIC...can any one else....there must be a byte to be had somewhere but I can't see it!
- dominicbeesley
- Posts: 2212
- Joined: Tue Apr 30, 2013 12:16 pm
- Contact:
Re: VCCC2023: Christmas Challenge
EOR...
Nice!
Nice!
- flaxcottage
- Posts: 5723
- Joined: Thu Dec 13, 2012 8:46 pm
- Location: Derbyshire
- Contact:
Re: VCCC2023: Christmas Challenge
Very nice indeed. Once given the idea I shaved two bytes off the code and it still is within the rules, I think.
What is irksome is that the fossilisation of the intellect from which I suffer prevented me from seeing this solution in the first place.
I went down the VDU28 route and that was over twice as long but quicker.
What is irksome is that the fossilisation of the intellect from which I suffer prevented me from seeing this solution in the first place.
I went down the VDU28 route and that was over twice as long but quicker.
Re: VCCC2023: Christmas Challenge
I'd say requiring the CLS before running was pushing the boundaries why not go the whole hog and prepare the picture in memory and just copy it across.
- Rich Talbot-Watkins
- Posts: 2054
- Joined: Thu Jan 13, 2005 5:20 pm
- Location: Palma, Mallorca
- Contact:
Re: VCCC2023: Christmas Challenge
No, I didn't bother! Just thought I'd keep it here on Stardot where it mattersdominicbeesley wrote: ↑Sat Dec 30, 2023 8:01 pm Did you enter those rtw? I didn't spot them in the video...I thought I'd got the third smallest BASIC program but evidently not.
Just shrunk mine down to 47 bytes using that great EOR/AND trick to avoid needing extra brackets! But that's where I stop.
Owlet
Code: Select all
FORy=0TO18:FORx=3TO21:VDU9EOR35AND(x*x-y*y)MOD6=0:NEXT:PRINT:NEXT
- flaxcottage
- Posts: 5723
- Joined: Thu Dec 13, 2012 8:46 pm
- Location: Derbyshire
- Contact:
Re: VCCC2023: Christmas Challenge
Thought about that but it needs too much data, which had to be declared and included in the total size.
Can't use RUN|L or RUN|Z because they move VPOS. Using CLS:RUN puts these commands in the keyboard buffer so that CLS zeroes VPOS and POS; RUN is executed and the change of VPOS due to the [CR] is executed after the program has run. At least that's what I think happens.
Yes, the boundary is being pushed, I agree, but just a little bit. After all every little counts when saving a byte or two.
Nevertheless the original solution is really elegant.
- BeebMaster
- Posts: 7437
- Joined: Sun Aug 02, 2009 5:59 pm
- Location: Lost in the BeebVault!
- Contact:
Re: VCCC2023: Christmas Challenge
I think doing CLS:RUN is within the rules, it doesn't specify that the screen must be cleared when running, and some of the entries have the pattern drawn over the start-up screen anyway.
I think what wouldn't be allowed would be declaring all the variables on the command line then a GOTO, eg. A=6:B=6:CLS:GOTO10 would be cheating a bit.
I think what wouldn't be allowed would be declaring all the variables on the command line then a GOTO, eg. A=6:B=6:CLS:GOTO10 would be cheating a bit.
Re: VCCC2023: Christmas Challenge
But this program won't work without the CLS. So I would say that it fundamental to its operation
Re: VCCC2023: Christmas Challenge
I would argue that in the case of solutions like this:BeebMaster wrote: ↑Sun Dec 31, 2023 12:04 pm I think doing CLS:RUN is within the rules, it doesn't specify that the screen must be cleared when running, and some of the entries have the pattern drawn over the start-up screen anyway.
Code: Select all
1CLS:REPEATVDU9EORABS(VPOS^2-POS^2)MOD6=3ANDPOS<19AND35:UNTILVPOS>18
(Edit: snap)
Dave
- BeebMaster
- Posts: 7437
- Joined: Sun Aug 02, 2009 5:59 pm
- Location: Lost in the BeebVault!
- Contact:
Re: VCCC2023: Christmas Challenge
Fair enough. In my case, with absolute co-ordinates using PRINTTAB it didn't matter if the screen was cleared or not for the cursor position.
- Rich Talbot-Watkins
- Posts: 2054
- Joined: Thu Jan 13, 2005 5:20 pm
- Location: Palma, Mallorca
- Contact:
Re: VCCC2023: Christmas Challenge
Just noticed that this one works in fundamentally the same way as mine, using a*a-b*b mod 6 as the condition for drawing a star vs a space. Bravo!hoglet wrote: ↑Sun Dec 31, 2023 12:23 pmCode: Select all
1CLS:REPEATVDU9EORABS(VPOS^2-POS^2)MOD6=3ANDPOS<19AND35:UNTILVPOS>18
Re: VCCC2023: Christmas Challenge
This is David Payne's entry (which won the smallest BASIC program category), plus a small change by me to save one further byte.Rich Talbot-Watkins wrote: ↑Sun Dec 31, 2023 2:15 pmJust noticed that this one works in fundamentally the same way as mine, using a*a-b*b mod 6 as the condition for drawing a star vs a space. Bravo!hoglet wrote: ↑Sun Dec 31, 2023 12:23 pmCode: Select all
1CLS:REPEATVDU9EORABS(VPOS^2-POS^2)MOD6=3ANDPOS<19AND35:UNTILVPOS>18
Re: VCCC2023: Christmas Challenge
I must confess, I forgot all about POS and VPOS, so I never even considered a BASIC solution might come out smaller!
I thought I had clinched it with my cunning use of numbers in the lookup table that would sum to exactly 41 wherever a star was to be printed, and then using SEC to add an extra 1 giving 42 -- the ASCII code for * -- or printing a space otherwise.
I thought I had clinched it with my cunning use of numbers in the lookup table that would sum to exactly 41 wherever a star was to be printed, and then using SEC to add an extra 1 giving 42 -- the ASCII code for * -- or printing a space otherwise.
Re: VCCC2023: Christmas Challenge
I see though that you are the first featured in the wild compo videoDiminished wrote: ↑Sat Dec 30, 2023 7:10 pm Well, my animated wild entry wasn't even shown moving in the results video…
https://youtu.be/IbeVP_pDOPk?si=LDP3TXUZlkwB9ULa
Re: VCCC2023: Christmas Challenge
Well, I actually managed to get the machine code version down to just 38 bytes, using a slightly dirty technique .....
Owlet Link
Is that even within the spirit of the rules? Can you stomp on memory outside of your program and not claim it as part of what you're using?
Owlet Link
Is that even within the spirit of the rules? Can you stomp on memory outside of your program and not claim it as part of what you're using?
Re: VCCC2023: Christmas Challenge
I don't see what might be wrong with what you're doing there - from pattern to P% is all the initialised memory, I think? Looks pretty neat and tidy! (Can't get my head around what you're doing with O% though... is there something going on there?)
Re: VCCC2023: Christmas Challenge
The Owlet version assembles directly at P%, so the code can be run in-situ. The original assembled the code offset, because technically it was trespassing on a bit of zero page that neither BASIC nor MOS seem to write anything to but isn't advertised as available for the user, and required it to be run from disc. There may be vestigial organs left over from an ancestor's niche
EDIT: Also, 37 bytes.
EDIT: Also, 37 bytes.
- BeebMaster
- Posts: 7437
- Joined: Sun Aug 02, 2009 5:59 pm
- Location: Lost in the BeebVault!
- Contact:
Re: VCCC2023: Christmas Challenge
Last year, or the year before, I used @% to store a string variable, as it was the only existing variable I could use where the location was guaranteed (ie. &90A) to be available to store data, without having to declare a new variable or do a DIM, and I didn't get arrested or banned.
Re: VCCC2023: Christmas Challenge
All these put my 107 bytes to shame. I never thought of relying on the display position, I just outputted directly on from wherever the program started.
It did take a couple of Doh! moments to realise some of the optimisations. Going ABS(minus to plus) to get a triangle wave is something I commonly do, yet I forgot almost until the last moment with this. And it took a silly amount of time to realise the L=0 state could be shared with the L=3 state.
Code: Select all
10 FORA%=0TO18:L=ABS(A%MOD6-3):IFL=0:PRINT"* ";
20 IFL=3ORL=0:PRINTSPC3"*"SPC5"*"SPC5"*"ELSEIFL=1:PRINTSTRING$(3," * *")ELSEIFL=2:PRINTSTRING$(3," * * ")
30 NEXT
Code: Select all
$ bbcbasic
PDP11 BBC BASIC IV Version 0.45
(C) Copyright J.G.Harston 1989,2005-2024
>_
Re: VCCC2023: Christmas Challenge
For my wildcard, I took the demo exactly as specified:
Code: Select all
$ bbcbasic
PDP11 BBC BASIC IV Version 0.45
(C) Copyright J.G.Harston 1989,2005-2024
>_
-
- Posts: 10
- Joined: Sat Jul 16, 2022 6:00 pm
- Contact:
Re: VCCC2023: Christmas Challenge
I had a lot of fun, it was my first attempt at "pro" coding and I'm surprised not being the last... and not the last Beeb BASIC entry too. As I thought the screen had to be cleaned, a CLS slipped in. No way for me to find any math logic in the design, gone brute force with strings . I'd like to do more of that stuff, it's gratifying even if you don't win.