I’ve been writing code for a very long time. I like to think I’m good at it, but know also that I can be better. My current job, as much as I enjoy it, has limited scope for writing software; it’s typically limited to writing Infrastructure as Code which is close, but not entirely the same.
To scratch that itch, and keep skills honed, I like to make use of puzzle websites. These are websites which contain a series of challenges. Typically they start off simple and get more complex but this isn’t necessarily the case. Those that do, are good for people learning a language because simpler problems will likely use less complex code constructs, but they also provide the opportunity to challenge more seasoned developers.
Once in a while I’ll use one of these sites to experiment with a language other than the one(s) I use most regularly at the time; those at present being Ruby and Python. I like to compare the type of approach that one uses in one language with that which would be used in another. Sometimes I find that my use of one language will even impact how I write another. (This happens to me in spoken languages too.)
These puzzle websites usually have a discussion forum which is hidden from view until a puzzle has been solved. I have found this wonderfully instructive because there have been occasions where I’ve solved the problem in a convoluted way but read some of the solutions submitted by others and can then learn something.
Here are some of the puzzle websites I’ve encountered
Project Euler
I think this is the first puzzle-based website I started using with any regularity or perseverance. I discovered this website in 2008 ish. I started using it to improve my mathematical skills rather than programming, though I do usually write code to solve them. (There have been a couple I’ve solved by hand with pen and paper)
This website doesn’t take code as a submission; instead it asks for the answer which is almost always a number but is occasionally a word or series of letters.
As much as I enjoy maths, I’m finding the limits of my mathematical ability. The later ones are well beyond my reach but there’s lots left of the early ones for me to solve still. I’ve completed 114 out of 775.
A new puzzle is published approximately every week. It’s suggested on the site, but I repeat it here for the sake of this article: Don’t try for a brute-force approach, It may work for the early puzzles, but it definitely won’t for the later ones.
shelly.dev
I discovered this one only a couple of months ago. The goal for this website is to draw shapes in as few moves as possible using a dialect of Logo. There are 33 puzzles (at the time of writing) but there’s a sandbox so you can have a play with the language too.
I don’t use Logo as part of my job but I have feelings of nostalgia towards the language because it’s one of the earliest languages I used. I first encountered Logo in the 80s at school on the BBC Micro (through which I also learned BASIC)
With this website you can also create your own challanges and offer them to other site participants.
Solutions are not shared even one solved, but the website does have a recommended number of steps with which to solve each puzzle and awards a bonus if your solution uses fewer steps than this.
microcorruption.com
The theme for this website is an electronic lock. The challenges take the form of using carefully constructed usernames and passwords to cause the lock to open without knowing the genuine credentials. The firmware to the locks is made available, and is written in machine code for the MSP430 processor. I’d not encountered this processor before discovering this website. My experiences with processors thus far has been limted to ARM, 6502, 68000, Z80 and MIPS
I don’t do much electronics these days, but this website is a fun way to keep a toe in the water.
No user-contributed challanges and no sharing of solutions. But definitely one of my favourites.
CodeWars
This is a very comprehensive site. It has a series of challenges in lots of different languages and as a participant in the site you can chose in which languages you’d like to see the puzzles.
The challenges take the for of a text description and a series of automated tests (written in code). Your goal is to write code to get these tests to pass and then your submission will be subjected to further more rigorous testing.
User contributed puzzles are welcomed; indeed this is how the site thrives. You can see other people’s submissions and compare them to yours. On this site in particular, I am frequently impressed by the variety of approaches that people take compared to my own.
PostgreSQL Exercises
I’ve only had a small play with this one. But it is a good place to practice SQL skills. It shows sample tables (both structure and their content) and then shows what data the site wishes to be extracted. The challenge is to write the SQL query to retrieve this data.
SQL has dialectal variations between different DBMSs but this site is focussed on Postgres
AdventOfCode
Topical for this time of year! This website has two closely-related puzzles per day for the first 25 days of December, and has been running every year since 2015.
The challenges are usually based around text manipulation though there are a few algorithmic related ones, and the puzzles from year 2019 featured several in which an emulator for a fictitious CPU is developed.
As well as a site-wide league table, this website allows you to create a league table amongst a group of friends/colleagues.
Odd and ends
There was also a couple of puzzle sites written in Flash that I used to play 10-ish years ago. But with Flash having discontinued in 2020 they are no longer available in their original forms.
The first one I’m thinking of is Lightbot, in which one pilots a robot around a tiled arena trying to light up certain squares. It’s a bit like Logo. This game is now available as a mobile game (still called Lightbot) though I’ve never tried it in this form.
The second Flash game was called Manufactoria. The game play for this was a finite-state machine, which was run by a robot which would run around an arena containing directional conveyor belts bridges etc, and the goal was to turn one input pattern into another, or to accept/reject certain input patterns based on criteria specific to the puzzle.
There’s also the website exercism which I discovered whilst writing this article, though I’ve never used it. At first glance, it looks a bit like CodeWars so is good if you wish to work on several languages.
Finally, there’s a collection of links in this Reddit thread. Some of them are mentioned here, but I’ve not checkout out all of them.
Closing notes
As part of my job, I occasionally run training courses in Python. I usually suggest this sort of website to give ideas and practice drills to students for content after the course.
Do you know of any others? Do you run one, even? (Are you involved with ones of the sites I’ve mentioned? Please say hello if so)