Basic Computer Games

My first computer was Atari 65 XE. We’ve bought it from some friend of my uncle. I’ve received it with lots of games and quite a collection of computer magazines and literature. These were the days when your magazine printed full code listings which you could then type into your computer and have a working program, or a game. It was usually in Basic. I’ve never did it. I was about 10 then. Couldn’t focus so much. Had lots of video games and other stuff to do. Back then kids actually spent time outdoors, you know. So, I’m not one of this wonder kids who started coding at the age of 5 and at the age of 10 they’ve built their own kernel or at least some AI. But I’ve fallen in love with computers and always wanted to work with them. There was also some hidden magic behind Basic which I’ve felt, even though I’ve never really coded in it.

Then life went on and I wasn’t studying programming, even though I wanted to. And I’ve not been writing code for work till quite recently. But programming was always somewhere in the back of the head for me and something pulled me to it. Now it’s been few years since I’m paid mainly for writing code. And I love it. I’m not a full time developer, sadly. But I’m spending lots of time learning and coding. I also like riddles and challenges.

First time I’ve heard about Basic Computer Games was back in February 2021. I’m following Jeff Atwood on Twitter, and I’ve learnt about it from him. I’ve thought it’s great initiative, was immediately hooked up and started coding. But I started with Amazing. Which is a program generating maze of given size. And that was a mistake:( As I’ve mentioned, I’ve never really coded in Basic and this program isn’t trivial. I’ve started to rewrite it in Go. I’ve printed the source code and marked it with my pen trying to figure out where code goes next. But I’ve failed. I was able to generate interesting stuff, but never mazes as depicted in the book. I’ve given up.

But on the first day of 2022 I’ve heard about it again, and again from Jeff Atwood. This time he has limited number of possible languages, Go wasn’t on the list, but C# was. And I’m earning my money with C#. So, I’ve decided to give it another go. I’ve chosen Buzzword, a really low hanging fruit;) But I’ve finished it, had fun writing it, and even submitted a pull request to official repo and got merged. So, I’m now a contributor;)

This has given me energy to do another one, Change. This was interesting one, however it was not very challenging. But, I still don’t know how the author got below from his code:

Original result

I’m getting (and same is true for code submitted in Python):

Cost of item? 80.80
Amount of payment? 100
Your change $19.20
1 ten dollar bill(s)
1 five dollar bill(s)
4 one dollar bill(s)
2 dime(s)
Thank you, come again!

I’ve read the original code few times and I can’t see how output different than mine is possible. Oh well. I’ve submitted my code, so soon the power of internet will point out my errors. As no code on Github can remain unchecked, there would always be a person who’ll point out your mistakes. And I love it!