The comp.sys.sinclair Crap Games Competition 2021 - 25th edition!

 

COMPETITION ENTRY #56: AVOID SANTA

Author:  Giannis "Firelord" Model:  16K Spectrum Format:    .TAP
Submission date:  11 December 2021 Documentation:  brief background & instructions Tested on:  Spectaculator 8.0

Download it here

Giannis the Firelord returns for a fourth assault on my sanity - or so I had assumed, given his previous three entries. Maybe he got the message that I was getting annoyed because this - and you may all celebrate wildly - isn't another copy of Find Santa, it's a completely new game, and actually has something I can dig deeper into! Not much deeper, mind, because it's only 1.8K of BASIC.

In not-quite-corporate-Santa colours of black on red, we're presented with a title screen with a flashing Chunk-o-Vision-enhanced title, "Version 1.01" and tomorrow's date, as it was when I received the game. And, I can barely believe what I see - properly wrapped text! There's hope for this one. Anyway, to the game: Santa is angry at us - hopefully this is not Futurama Santa or we're really in trouble - and we have to hide in one of seven locations. Then, there will be a set of three questions, all of them "Is your hiding place here?" with four possible locations. Answer all these three questions honestly and Santa will find you, you're on the Naughty List, and a lump of coal - or worse - will be deposited in your sock. Or worse.

Even though this is a new program, haven't we seen this somewhere before? It has a striking resemblance to the machinations of Magiapotagia. But does it work the same way? There's only one thing for it - dive into the code, take it to bits and investigate. It look longer than I'd thought it would to unravel the processes going on; I find it doesn't use arrays to keep track of which locations are present or absent in each round, the only array is to hold the names of the locations. How it's done is...

SPOILER ALERT: (highlight the black text below to reveal it)
A subroutine at line 1000 is called three times, in which the variable B will be set to 1, 2 or 4. The variable C is set such that a calculation with a logical B AND C in line 1030 causes the subroutine to show the four locations required in each round; if it sees location 7, which will be present every time, it returns.
In round 1, we're shown the odd-numbered locations, thus narrowing our location down to odds or evens. In round 2, we're shown locations 2, 3, 6 and 7, thus further narrowing our location down to two odd or even numbers that are 4 apart (i.e. 1 or 5, 2 or 6, 3 or 7 - and if we're in location 4, we've technically been found already). In the third round, we're shown locations 4, 5, 6 and 7, which - if we're not in location 4, decides between the lower and higher numbers in each of the other cases. The variable X tracks our choices, B is added to it after each round where we've said our location is shown, and after the three rounds, X will be our location. If we've said "no" to the location being shown every time, X is 0 and it knows we've cheated.

SPOILER ENDS.

As with Magiapotagia, I have a suspicion that the algorithm used in this process has existed since computers were the size of a large room and cost enough arms and legs to keep the Paralympics stocked with athletes for a century, and Giannis has merely worked it into Spectrum BASIC (or copied it, Harry S. Price style, from a book - the REM statement in line 6 that mentions 101 Programs For SPECTRUM by "Firelord Quality Games Ltd" might be a case of hiding in plain sight!). I can't prove that there was any plagiarism, so I'll let this one slide, mainly because it's supposed to be the season of goodwill to all men, women and Commodore owners.

Good job, Giannis - this was never going to be more than a two-and-two, given its rudimentary nature, but you've heeded my warning to tighten the loose nuts from the first three attempts, done nothing that deserves a demerit this time, and given me half an hour's worth of amusement unravelling the secrets of the subroutine that makes this entire game work. And, for the first time, if I was the editor of Sinclair Programs and trying to put a Christmas 1982 edition together, I'd print this one in my magazine... not that any of the Sinclair magazines that existed in 1982 had any Christmas-themed programs that I could find.

You're off Santa's Naughty List, Giannis. Merry Greek Orthodox Christmas... on 7th January, and it'll be a Happy New CSSCGC by that time, I would hope!

EDIT (12 December 2021): Giannis came clean on this one - it's adapted from an old type-in, though he didn't specify which one or where it had been published. I will not be retrospectively adding it to the Green Challenge.

EFFORT:      ATTAINMENT:      DEMERITS:   none