VCCC2023: Christmas Challenge

bbc micro/electron/atom/risc os coding queries and routines
dp11
Posts: 1762
Joined: Sun Aug 12, 2012 9:47 pm
Contact:

Re: VCCC2023: Christmas Challenge

Post by dp11 »

I've tried a number of different ways and they actually come out similar. I would like to know if I need to try harder.
Phil_G
Posts: 6
Joined: Mon Jan 16, 2023 10:20 pm
Contact:

Re: VCCC2023: Christmas Challenge

Post by Phil_G »

I missed out on last year's Star competition because I didnt read the submission instructions properly :|

https://www.youtube.com/watch?v=Rv_YLNM5ByA
User avatar
BigEd
Posts: 6276
Joined: Sun Jan 24, 2010 10:24 am
Location: West Country
Contact:

Re: VCCC2023: Christmas Challenge

Post by BigEd »

dp11 wrote: Mon Dec 11, 2023 10:53 pm I've tried a number of different ways and they actually come out similar. I would like to know if I need to try harder.
From past experience, the smallest code is always surprisingly smaller than one's best code, so there's always a better way. (It's true for everyone except just one person...)
User avatar
JohnH
Posts: 85
Joined: Thu Aug 11, 2016 10:59 pm
Contact:

Re: VCCC2023: Christmas Challenge

Post by JohnH »

Had a thought as I was falling asleep last night and saved one more byte, wife was not impressed when I told her :lol:

Gonna need a new approach if I'm to get any smaller now.
fuzzel
Posts: 1192
Joined: Sun Jan 02, 2005 1:16 pm
Location: Cullercoats, North Tyneside
Contact:

Re: VCCC2023: Christmas Challenge

Post by fuzzel »

Wow! Just had another one of those eureka moments, again whilst walking, and broadaxed another 20 bytes off my best to date. There'll be nothing left soon!
User avatar
flaxcottage
Posts: 5721
Joined: Thu Dec 13, 2012 8:46 pm
Location: Derbyshire
Contact:

Re: VCCC2023: Christmas Challenge

Post by flaxcottage »

Just discovered that if I don't print the stars I can save 15 bytes. :lol:
- John

Check out the Educational Software Archive at www.flaxcottage.com
fuzzel
Posts: 1192
Joined: Sun Jan 02, 2005 1:16 pm
Location: Cullercoats, North Tyneside
Contact:

Re: VCCC2023: Christmas Challenge

Post by fuzzel »

Does that mean your best so far is 15 ? Impressive.
User avatar
BeebMaster
Posts: 7394
Joined: Sun Aug 02, 2009 5:59 pm
Location: Lost in the BeebVault!
Contact:

Re: VCCC2023: Christmas Challenge

Post by BeebMaster »

I had a few days off it while I concentrated on another self-imposed coding challenge, which was to make an RLE compression encoder and decoder. I think I've ironed that out now, but I need to throw more files at it to make sure it decodes the encoded files back to the exact original in all cases.

I went back to the Christmas challenge last night and lost all track of time, spending 3 hours on it. I managed to put in an optimisation which I knew would be possible. Must have taken me about 300 permutations of code to do it though! Saved quite a bit. I just think there may be one more thing I can do to make it smaller.
Image
User avatar
regregex
Posts: 633
Joined: Sun Jan 02, 2005 9:51 pm
Location: London, UK
Contact:

Re: VCCC2023: Christmas Challenge

Post by regregex »

BeebMaster wrote: Wed Dec 13, 2023 10:33 amMust have taken me about 300 permutations of code
On the same hunch that I had all the other right ingredients I ended up guessing parts of my program by trial and error. [edit: spoiler removed]
Last edited by regregex on Wed Dec 13, 2023 1:37 pm, edited 1 time in total.
User avatar
Diminished
Posts: 1240
Joined: Fri Dec 08, 2017 9:47 pm
Contact:

Re: VCCC2023: Christmas Challenge

Post by Diminished »

regregex wrote: Wed Dec 13, 2023 12:46 pm On the same hunch that I had all the other right ingredients...
This is a spoiler.

It's in the first post, in large red letters. No discussion of techniques.
User avatar
BeebMaster
Posts: 7394
Joined: Sun Aug 02, 2009 5:59 pm
Location: Lost in the BeebVault!
Contact:

Re: VCCC2023: Christmas Challenge

Post by BeebMaster »

Mmm I think we should ask the mods to lock this thread till 3.10pm on Christmas Day to prevent any more inadvertent inappropriate revelations. Otherwise I may have to tut again. At myself.
Image
User avatar
flaxcottage
Posts: 5721
Joined: Thu Dec 13, 2012 8:46 pm
Location: Derbyshire
Contact:

Re: VCCC2023: Christmas Challenge

Post by flaxcottage »

This is getting to be really compulsive - the struggle to save a byte.

Best not to do it though after several pints of cider as you get stars before your eyes! :lol:
- John

Check out the Educational Software Archive at www.flaxcottage.com
User avatar
flaxcottage
Posts: 5721
Joined: Thu Dec 13, 2012 8:46 pm
Location: Derbyshire
Contact:

Re: VCCC2023: Christmas Challenge

Post by flaxcottage »

Just had a thought whilst staring at stars and this has nothing to do with the VCCC2023 task as such.

Would it be possible to start at any star on the output and trace a line through all the stars in turn without ever going over a line already there and not taking the pencil off the paper? Lines may cross and meet but not be overlaid.

I found one and then I thought I ought to get out more!
- John

Check out the Educational Software Archive at www.flaxcottage.com
SteveF
Posts: 1683
Joined: Fri Aug 28, 2015 9:34 pm
Contact:

Re: VCCC2023: Christmas Challenge

Post by SteveF »

I thought I wasn't going to enter this year, but I found myself at a loose end and had a go. It was surprisingly absorbing, even though I shouldn't be surprised really.

I haven't submitted yet as I may find a way to save a byte. So far I also haven't tried multiple approaches, I just picked something fun, so it's quite possible that as well as cleverer and shorter ways than mine, there are more obvious and shorter ways. Unless I get a severe need to procrastinate on something else, I suspect I'll stick with my current approach and just micro-optimise it. :-)
julie_m
Posts: 595
Joined: Wed Jul 24, 2019 9:53 pm
Location: Derby, UK
Contact:

Re: VCCC2023: Christmas Challenge

Post by julie_m »

flaxcottage wrote: Thu Dec 14, 2023 4:41 pm Would it be possible to start at any star on the output and trace a line through all the stars in turn without ever going over a line already there and not taking the pencil off the paper? Lines may cross and meet but not be overlaid.
A shape can be drawn in one line if and only if it contains no or two vertices with an odd number of edges. In the latter case, you have to start one one and finish on the other. If every vertex connects an even number of edges, you can start anywhere.
User avatar
flaxcottage
Posts: 5721
Joined: Thu Dec 13, 2012 8:46 pm
Location: Derbyshire
Contact:

Re: VCCC2023: Christmas Challenge

Post by flaxcottage »

Wow! That sounds technical. :shock:

Does this mean that I did it and don't know why? Not knowing why is a daily condition with me. :lol:
- John

Check out the Educational Software Archive at www.flaxcottage.com
User avatar
JohnH
Posts: 85
Joined: Thu Aug 11, 2016 10:59 pm
Contact:

Re: VCCC2023: Christmas Challenge

Post by JohnH »

Well I've submitted my entry, I couldn't find any more bytes to save. I considered trying to do it in assembler but given how BASIC tokenizes things I wasn't convinced it would be any smaller. I still might try that just out of interest.
elkrepair
Posts: 79
Joined: Tue Nov 13, 2018 1:53 pm
Contact:

Re: VCCC2023: Christmas Challenge

Post by elkrepair »

Just as you think it can't be improved, the penny drops and you throw your hands up in disbelief and say out loud "why am I doing that"!

14 bytes removed.
Elk rev 4 & Plus1
BBC B rev 7 & Cumana Disc Drive
BBC micro:bit 1 & 2
RaspberryPi B+ & 3B & Zero
Abit BP6
User avatar
flaxcottage
Posts: 5721
Joined: Thu Dec 13, 2012 8:46 pm
Location: Derbyshire
Contact:

Re: VCCC2023: Christmas Challenge

Post by flaxcottage »

JohnH wrote: Sun Dec 17, 2023 6:24 pm Well I've submitted my entry, I couldn't find any more bytes to save. I considered trying to do it in assembler but given how BASIC tokenizes things I wasn't convinced it would be any smaller. I still might try that just out of interest.
Snap! :D

And my 6502 coding is not all that sharp either.
- John

Check out the Educational Software Archive at www.flaxcottage.com
User avatar
BeebMaster
Posts: 7394
Joined: Sun Aug 02, 2009 5:59 pm
Location: Lost in the BeebVault!
Contact:

Re: VCCC2023: Christmas Challenge

Post by BeebMaster »

I am about to send mine in, only because it's the only way to guarantee having done so I will be able to save that byte!

Multiple submissions are allowed by the way I believe.

(Well, rules say one update may be allowed, in fact.)
Image
User avatar
Diminished
Posts: 1240
Joined: Fri Dec 08, 2017 9:47 pm
Contact:

Re: VCCC2023: Christmas Challenge

Post by Diminished »

Well, I have a submission in BASIC, but I doubt it's very good. Most of my effort has been going into an entry for the open ("wild") category instead, but I am running out of time to finish it. :(
User avatar
BeebMaster
Posts: 7394
Joined: Sun Aug 02, 2009 5:59 pm
Location: Lost in the BeebVault!
Contact:

Re: VCCC2023: Christmas Challenge

Post by BeebMaster »

Change your name to F Christmas, I believe anyone with that name gets an unlimited 24th December every year.
Image
User avatar
JohnH
Posts: 85
Joined: Thu Aug 11, 2016 10:59 pm
Contact:

Re: VCCC2023: Christmas Challenge

Post by JohnH »

Are you allowed multiple submissions if they use different languages?
User avatar
Diminished
Posts: 1240
Joined: Fri Dec 08, 2017 9:47 pm
Contact:

Re: VCCC2023: Christmas Challenge

Post by Diminished »

JohnH wrote: Tue Dec 19, 2023 12:58 pm Are you allowed multiple submissions if they use different languages?
I submitted separate BASIC and assembler entries last year, so I think so, yes.
User avatar
JohnH
Posts: 85
Joined: Thu Aug 11, 2016 10:59 pm
Contact:

Re: VCCC2023: Christmas Challenge

Post by JohnH »

Just thought of a different method as I was pondering doing it in assembler. Data will be smaller but code possibly larger. Will it be smaller overall though? I'll have to code it up (in BASIC) and see. If it is I might try an assembler version.
User avatar
anightin
Posts: 970
Joined: Thu Aug 23, 2018 2:03 pm
Location: Cambridge UK
Contact:

Re: VCCC2023: Christmas Challenge

Post by anightin »

Code: Select all

10 OSCLI "L. "+"P"+" 7C00"
Where P is a screen dump of the pattern :)

No? :wink:

Merry Christmas!
julie_m
Posts: 595
Joined: Wed Jul 24, 2019 9:53 pm
Location: Derby, UK
Contact:

Re: VCCC2023: Christmas Challenge

Post by julie_m »

Don't forget to include the data for the screen contents (I don't think it's giving away too much to say at least 739 bytes) in your total .....
User avatar
JohnH
Posts: 85
Joined: Thu Aug 11, 2016 10:59 pm
Contact:

Re: VCCC2023: Christmas Challenge

Post by JohnH »

Bah! just managed to save 2 bytes from the BASIC version I've already submitted. May have to delete and re-submit and it's such a simple thing, why didn't I see it before?!
julie_m
Posts: 595
Joined: Wed Jul 24, 2019 9:53 pm
Location: Derby, UK
Contact:

Re: VCCC2023: Christmas Challenge

Post by julie_m »

I was just about to hit upload on my entry, when a flash of inspiration struck me and I found a way to save four, count 'em, 4 whole bytes.

My entry last year was not the smallest because I included some housekeeping code to set the MODE and try to centre the image. This year's version delivers it straight and just prints the pattern, no bells or whistles. I'm playing for life or death here, baby. No more Goody2Shoes, or even Goody0Shoes .....

Anyway, nothing for it now but to wait, I suppose .....
User avatar
BeebMaster
Posts: 7394
Joined: Sun Aug 02, 2009 5:59 pm
Location: Lost in the BeebVault!
Contact:

Re: VCCC2023: Christmas Challenge

Post by BeebMaster »

Sent mine in earlier today. After having so much fun with the L3 file server this week, I nearly forgot!
Image
Post Reply

Return to “programming”