Just passed the 200th blog entry
At a rate of one per day. So far I’ve missed no days! Here’s the montage of the last 100 images…

Learn C Games Programming Blog
A blog about C, programming games and my ebook(s).
At a rate of one per day. So far I’ve missed no days! Here’s the montage of the last 100 images…

I occasionally answer (often in a somewhat ascerbic tone) questions on Quora.com, not just programming though that;’s the bulk of my answers. Feel free to follow me there! One question today was asking whether it was better to deveIop IO games on Web or mobile first.
I’d never really looked at this category- what is an IO Game? Very loosely, its the replacement for Flash games, and unlike those, it can run on mobile or cross-platform. A typical development system for such games is Godot, an open source cross-platform development system. The main language is GDScript based loosely on Python but any programming languages that has GDNative bindings (so C++, C#, Rust, Nim, D and any others I don’t know about. ).
You get games like the multiplayer game agar.io which has an entry on Wikipedia and is cited as an example of an IO game.
This is more of a tip, but it can be a useful thing to know. If you look at this photo you’ll see it contains a bunch of words. Now you could type them in but that’s a bit tedious.
If you have Ms Office then you’ll have probably have OneNote. Take the image and paste it into OneNote. Now right click on the image (in OneNote and in the popup menu) you should see Copy Text from Picture as the third item in the menu.
Just click that then paste the text in to notepad, a text editor, whatever. There’s your text.

Here’s the text pasted directly from the clipboard. 100% accurate apart from a ! that it found from somewhere near the edge (just after wain)!
Solution to Puzzle 1
ain, alb, albs, als, ani, ard, ards, arid, ars, awn, blah, blain, dhal
dhals, dirl, dirls, drain, draw, drawn, fah, fain, fan, far, fard, tards,
farl, farls, fars, faw, fawn, flan, flaw, flawn, fra, hain, half, halts, han,
hard, hards, harl, harls, harn, harns, haw, hid, ids, infra, inward,
inwards, lah, lain, lar, lard, lards, larn, larns, law, lawin, lawn, nard,
nards, rah, rai, rain, ran, rani, raw, rawn, rid, rids, slain, slaw, wain, !
wald, walds, wan, war, ward, wards, warn, warns, wars, wha, wharf,
wharfs, whid, whids, whir, whirl, whirls, whirs, Win

One of C’s not so brilliant features is the range of Undefined Behaviour (UB). Things like using an uninitialised variable or having an int variable overflow don’t have behaviour defined; thus it is UB and you cannot accurately predict what will happen. Likewise accessing a NULL pointer can cause odd behaviour. It gets more sophisticated than that. What if you type cast an int to a float?
The LLVM blog have an interesting set of posts on UB and it’s definitely worth reading. I’ve done a lot of C programming, so I’m rarely surprised by my programs but its useful to know about these things. In my case, I started with assembler programming and then learnt C++ and C in that order so my perspective has always been to try and understand whats going on deep down.
I noticed that the Covid lockdown had made streaming of chess games very popular and did a search to see if I could find the source of one in C. The first one I found was actually C++ (cout << is a bit of a giveaway!) but I found this one by a developer called Tom Kerrigan. It runs from the command line and the exe is just 157 KB in size.
Note it is copyrighted but he has put his source code out there so if you are interested in seeing how a chess program is written this is an excellent place to start. His code also includes a lot of comments and includes an opening book.
This assumes that you have the version 2004 of Windows 10. Run the command Winver (open a command line then type winver) to see what version you have.
WSL is Windows Subsystem for Linux and lets you run one of several Linuxes (after installing) in Windows. For now it is terminal only but you can debug programs using Visual Studio. WSL 2 is the current version of WSL though you can run the older WSL 1.
Your computer also needs to support Hyper-V Virtualization to run WSL 2. If it doesn’t you can run WSL 1.
Steps.
When I mean Search Window, I mean the one on the Toolbar that looks like this like a magnifying glass: (highlighted in the red square)
![]()
2. In the Powershell Windows, copy and paste this command:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
3. Next run this command in the same Windows:
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
4. Set WSL 2 as default with this Powershell command:
wsl --set-default-version 2
Now close the Powershell Window and in the search box type Store. You should see Microsoft Store. It’s an app on your PC. Click it to run it and type in Linux in the search box. Click Show all and you should see something like this. Pick one like Ubuntu, Debian etc. Apart from the ones with a price against them, the rest are free. Cl;ick Get and it will install.

After it has installed, you can run it from your Start Menu. I dragged it onto the square so I have a nice clickable icon.
Just click it and your Ubuntu (or whatever) Linux will open at a terminal prompt like this.


This last week has been a bad one for me technically speaking. First there was the Sky Q Minibox problem. I was away when it was originally setup. It would have saved me a couple of wasted days without Sky when it went wrong had I been present at the setup.
We had a power outage that lasted twenty minutes. When it came back everything powered up except the Sky Q Minibox. It displayed a couple of screens which said “when the screen goes blank, press the Home button on the Sky Q remote”. Nothing happened. Eventually (after a couple of days) I figured, it was a bit like an old BoomBox (cassette player) of mine that was never the same after a power outage. Something had blown perhaps. Time to contact technical support for a replacement?
But I did a last search and came across an interesting message on a forum. “Make sure your Sky Q Remote is paired with the Minibox”. This is one of those things that makes you sit it up and says “What?”. It’s just a remote, isn’t it , like the other ones. Except when I looked a bit closer I noticed it had no bulb or transparent plastic screen at the end. To cut a long story short, when it was paired (is it Bluetooth?) the Sky Q Minibox worked fine. D’oh… My first encounter with a non-Infra red TV remote.
Yesterday I struggled trying to run a program on my two Android phones. The same phones that had worked fine with MonoGame. This was a different software dev system (Android Studio) and a different programming language (Flutter). The trouble was sometimes it would recognise one of the phones (but not the other one) and when I started copying the program it failed with ADB Error 1. I was scratching my head over this. I’d tried configuring, all sorts, in Android Studio, in the phones. But nothing made a difference.
I did a Google and a StackOverflow answer showed up. Maybe the problem is your cable? Well I have a few Android cables lying around so I swapped it and sure enough. It worked, and now recognised both phones, the program copied and ran ok on both phones. So with the Sky remote, it was the old adage Assume= Makes an Ass of U and Me. and with the phones, I’d assumed it was the software. configuration that was wrong.
This is the 2nd edition. Author Jens Gustedt has generously allowed a free version to be downloaded from his website.
If you like his book which is also published by Manning then you should consider buying a copy. He provides a 35% discount for the print or E book version.
I scanned the E-book and must admit, the bit on signal handling taught me a lot that I didn’t know.
The E-book is nearly 300 pages long in 19 chapters.

The good news is that they are free; the bad news that are listed in a web page of 700 free courses. Still you might find something else that you are interested in!
If you search for C followed by a space (Ctrl+f in your browser on the web page) then there are only 35 hits, which means only 5% of the reading. There’s also a C++ for C programmers course in there as well.
This was compiled between 1996 and 2003 by Nick Parlante at Stanford college. It’s a 45 page PDF that summaries all the basic features of C.
It saves having to search online or through a reference book (I have the excellent O’Reilly C book as well). It has a few pitfalls to show you things to avoid and lots of short source examples.