7 small programming challenges (suitable for Basic)

From time to time I’ve had the idea to post a weekend coding challenge over on Stardot: my usual approach is to post on the Friday, and declare that there should be no hints or spoilers or sharing of ideas until the Sunday noon. It usually gets me and a few others programming. I always use Basic on an emulated Beeb and very rarely write more than a couple of screenfuls of code. Although I use BBC Basic, any variant would do, because the point is to have fun, rather than to compete.

Here are a selection which should all be widely applicable to most retro platforms. Only one is graphical. If you read only the first post of each thread, you can then challenge yourself.

A screen capture from a Numberphile video to illustrate that last:

4 Likes

I’m confused re. what’s supposed to be illustrated with Turing’s tricky tape teaser. Is it to come up with an algorithm that uses a million or a few million tape entries to complete?

Not necessarily… the idea is to illuminate Turing’s quoted statement:

Thus a problem might easily need a storage of three million entries, and if each entry was equally likely to be the next required the average journey up the tape would be through a million entries, and this would be intolerable.

If you find the statement intuitively obvious, there’s no challenge, but if you find it a little surprising (as I did) then the challenge is to write something - anything - which helps you to understand the claim.

For myself, it’s obvious that it doesn’t really matter about the million, it’s just quite a lot of entries, and the question is about what proportion of a tape one might - on average - have to traverse. It’s also obvious to me that we’re looking for the performance of random access, where the next location doesn’t bear any simple relation to the current location.

But it’s a very free-form challenge - whatever question you might want to answer about tape access times, you can try to write a program which illustrates it.

(Some people like to do a lot of mathematical analysis, maybe even so much they solve the problem without any code. I’m the opposite, I like to start with a FOR…NEXT loop and take it from there.)

1 Like

The Turing tape challenge reminds me of watching DECtape spool back and forth pretending to be a random access device. They were only 256kB long. And I think all the I/O was bit-banged (but I’m not 100% sure). Any DEC-o-philes remember how much the hardware did?

1 Like

All I know is the I/O was timing sensitive, as you had very little buffering on the devices.it is one
level up from bit banging. Linc tape may have been better. Where are you watching the DEC tape?
Dec tape is even slower than you think,as core is swapped in and out for the OS overlays,
You where ‘high on the hog’ if your pdp-8 had 8K of core.
Real men use 7 track mag tape,Poor people like myself dream of using a 8 track.:slight_smile:
Mag tape has the advantage of not needing core memory,unlike a random access device.
Ben.
PS I had once a digital cassette, but it got lost during a move,

My freshman year high school in California had a pdp-8/e with dual DECtapes. My high school in Massachusetts did one better. It had a pdp-8/a with dual floppies. I think both machines had 8k words. Even with floppies I still avoided languages and applications that used overlays. OS/8 Basic was one of the offenders, so I used Fortran II and assembly language. I now own a pdp-8/a CPU board. What amazes me is how complicated it is given the relative simplicity of the instruction set. .

While the ALU is messy , ROM’s really cleaned up the decoding logic to get it all on one pcb.
After this point. you had the CMOS PDP-8. At this time I am not sure who sold more, the PDP-8 or the PDP-11. Some where I read that DEC never planned to do a PDP-8 chip, but spent all their
development on a PDP - 11 chip set. I toyed with a Spare Time Gizmos PDP-8, but decided I wanted something with 18 bits instead.
SBC6120

If anyone’s wanting to experience small 12-bit computer goodness, STG haven’t sold that kit for years. An open source version was made at RetroBrew Computers Forum which now seems to be sold in kit form by several vendors. There’s even a front panel PCD designed by Dave Runkle for maximum blinkenlights.

PDP-8 BASIC is very basic indeed: IF can only GOTO, variable names are at most [A-Z][0-9], error codes are terse, and END isn’t optional. The 6120 doesn’t support PDP-8 extended floating point, so Fortran is also strictly single-precision.

(I have a spare all-socketed SBC6120-RBC board that someone can have for postage from Canada if they want it. It likely needs reflow, as somewhere it has a continuity error. Sourcing the Harris HD1-6120 CPU and 6402 UART as well as the rest of the BOM is left to the reader.)

After discovering Bernhard Baehr’s excellent PDP-8 simulator for the Mac, I am rethinking my hardware “museum.” I own a DECmate (with floppy drives in need of new felt “head pincher” pads), an unassembled Spare Time Gizmos 6120 kit, and a modest, working Apple collection.

But nowadays, what is truly becoming an endangered species is the vintage source code of proprietary, obsolete software.

Consider that DEC went out of business years ago. Unlike OpenVMS, which still lives on, PDP-11s have little commercial value, yet the sources for RSTS/E and its built-in BASIC PLUS language are locked away in a warehouse somewhere—or if we’re lucky, in the bowels of the Computer History Museum.

Reminds me of the final scene of Raiders of the Los Ark, where workers wheel the Ark of the Covenant, in its numbered wooden crate, into the depths of a government warehouse. Then the camera pulls back to reveal where this priceless artifact is heading: into a veritable sea of indistinguishable wooden crates. Roll credits…

1 Like