Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(+1)

Hi Ross, just received an email from Gunnar, no problem at all with the request 👍🏻

(1 edit) (+1)

I've added the modification from Out Bush (Knights Tour (All CPCs).dsk and Knights Tour.cdt).

Cool, initially I was hoping to squeeze it into 8 Lines, though had to go the full 10, still managed to get your Program Remarks in, though had to go on the same line. 

Apart from the Grid, everything else is PRINTed in using Redefined Symbol DATA (240..247), TAG & TAGOFF, using a Control Code to switch on the Graphics Write mode (prevents damage to the Grid). The initial Knight is Placed and Filled in using Redefined Symbol DATA (248..255). I would have got away with Drawing the Knight shape as your example shows, though needed to extract the Shape of the Knight to work out where the FILL needed to occur. Once I had that and worked out where the Number '1' was placed, I had the shape to Redefine Chars 248 to 255. In your version I noticed the FILL didn't reach behind the lower half of the Knight and the Number '1', though decided to hit that area anyway.

With all the Redefined Characters though, I had to Compact it right in to make it fit, CHR$(0) is used quite a bit which Cursor Copy cannot extract and CHR$(128), which Cursor Copy confuses as CHR$(32) needed to be defined as z$ and b$, while Redefining the Characters (hence the reason for their presence in those initial lines).

Cheers, Ross.

(+1)

Very nice work, Ross… really elegant solution.

I’ve not seen the SYMBOL via control code #19 trick used like that for a long time… nice bit of CPC nostalgia there.

Originally, the program used text and DRAW commands, which kept it compatible across all CPC models. I later switched to DRAWR-based graphics for the final version.

The knight itself came from an SVG of a chess piece… I wrote a small Python tool to convert the SVG into DRAWR statements, using a Douglas–Peucker simplification to reduce the number of points. In hindsight, graph paper might have been quicker… but the plan is to release the Python tool at some point in case it’s useful to others in the retro community.

One downside of the drawn version is that it does slow things down slightly… particularly if someone were following along move-by-move on a real board (admittedly unlikely!).

I did consider using embedded control characters for PAPER/INK/LOCATE, but deliberately avoided them for readability… especially when sharing plain text listings. Tools like JavaCPC don’t always handle control codes cleanly (LIST #8 works, but not perfectly), and I wanted the source to remain accessible even outside a CPC environment.

Your approach strikes a really nice balance… compact, compatible with both BASIC 1.0 and 1.1, and as a bonus it’s noticeably quicker to run.

Really nice work 👍

For my game "Revisiting the Exit" from last years contest, control codes were used extensively just to squeeze it into the PUR-120 category and for my code explanation I took screenshots with the code, explained what the standard command was for the most part (don't know why I didn't have it for the SYMBOL data though), and just had comments following that. I explained below how the Control Codes were obtained via keyboard, as well as the condensed characters through the use of CHR$() and Cursor Copy.  Magazines wouldn't have appreciated such a listing back in the day due to the control codes, though for this contest every keystroke matters.

Cheers, Ross.