My new gaming adventure

I haven’t been much of a gamer (at least not since childhood), until I started a new, casual gaming adventure in the last week or two. It started when we bought a Nintendo Switch for home.

We opted for the Switch because it seemed to be a better choice for the whole family. I also really like the sorts of games I’ve been hearing about from Nintendo.

We started off with Legends of Zelda: Breath of the Wild, Minecraft, and Fortnite (our son introduced me to this one). So far, Legends of Zelda is my favourite game on the Switch. It’s a remarkable adventure, and our son and I are constantly comparing notes about where to find gear, how to solve the next challenge, and how to stay alive in the game.

I’ve also started playing a game or two on my Android phone. I really enjoy Alto’s Adventure, in Zen mode. I like just skiing across the landscape, and getting back up each time I hit a rock, or fall down a crevice.

The imagery in Alto’s Adventure is wonderful. Even those moments after a crash have a profoundly contemplative feel to them,

My ideal would be to play Alto’s Adventure (or even the follow-up, Alto’s Odyssey – I haven’t started playing this one yet) on the Switch, but the game only seems to be available on iOS or Android.

Our next game is probably going to be Mario Kart 8. We want a game we can play together, and this one seems like a great option. I’m also looking forward to the launch of the Nintendo Switch Online service that seems like it will bring the older NES games to Switch devices as part of the subscription service.

The timing for this is great. I’m on vacation with our kids for the next two weeks, and playing games like these together are a great way to unwind between the outings we have planned.

Moving from Twitter to WordPress

I really like this post about how Matthew Haughey has switched to a WordPress blog from Twitter. Yes, this is partly because he chose WordPress.com. Mostly, though, it’s because of reasons like these:

On the second point, it killed my desire to ever blog about things or write more than a few sentences about complex subjects. I would go six months between writing something 1,000 words long to put online when that was something I’d do every few days pre-Twitter. When Twitter moved to 280 characters, all hope was lost, since there really was no reason to have a blog for anyone anymore. I didn’t like that everything I wrote ended up being hard to find or reference, and even hard for me to pull up myself when I wanted, where a blog makes it pretty dang easy to see everything you wrote about in the past.

Read Haughey’s full post “My own reasons for leaving Twitter” (and follow him, too!). Also read his thoughts about WordPress in 2018 (there’s room for improvement, for sure).

Featured image by Braden Hopkins on Unsplash

Practice Math – the Python Edition

One of my projects this Summer is to create a working version of my Practice Math project. The goal of this project is to create a site that my kids can use to practice their math.

The idea was to create a simple site that would randomly generate math equations that kids could use to practice addition, subtraction, multiplication, and division. To do this, the site would need to have the following functions, at least in the first phase of my project:

  1. Randomly generate two numbers, and a math operator to create an equation;
  2. Evaluate the solution to the equation;
  3. Prompt the child to offer an answer to the equation;
  4. Compare the child’s answer with the actual solution, and give feedback;
  5. Make sure that equations don’t produce negative solutions (our kids haven’t really learned how to work with numbers less than zero); and
  6. Round answers to two decimal places (it can be more than this, I just picked two decimal places for now).

Version 1 – the Javascript Edition

My initial version of the project was based on Javascript. You can find that one here, on GitHub. I wasn’t able to make much progress beyond randomly generating the numbers and math operators that would be used in equations.

I hadn’t worked out how to evaluate the randomly generated numbers, more move much beyond point two in my list of features. I’m certain it’s possible, I just hadn’t worked it out yet.

Version 2 – the Python Edition

I recently decided to return to learning Python. I last attempted to learn Python about a year and a half ago. At the time, I was learning Python 2.7.x. I didn’t move beyond loops at the time.

This time, I decided to start with Python 3.x, which is the current version. I’ve been learning when I have time, and I really like the language. I decided to revisit my Practice Math project and create a Python version to help me learn the language.

I finally sat down this morning, and worked on a script that does all six of the things I want it to do. I’ve published my code on GitHub, here. Here it is in action:

I can’t take credit for what you see there, not entirely. I borrowed pretty heavily from a few sources to produce the version you see there:

Cory Kramer’s solution (the third one in this list) was particularly helpful because it helped me split my code into disparate functions. This makes the script a lot easier to read, and tweak.

My current code still has some test stuff in it. For example, the script current prints the two generated numbers, the operator, and the solution so I can check that it’s all working properly:


print("\nThis is for troubleshooting purposes only:")
print(num1) # For testing
print(num2) # For testing
print(op) # For testing
print("\nWhat is {} {} {}? > ".format(num1, op, num2))
solution = round(eval(f"{num1} {op} {num2}"), 2)
print(solution) # For testing

Next steps

The next step is to create a web interface for this. A command line version is fine to play around with, but for this to be useful, it needs to be a web site. I haven’t worked out how to add a Javascript front-end to this (I believe it’s possible, I have no idea how to do it, though).

What I’ll rather do, though, is use a Python web framework like Django to create a front end for the site. I’m really keen to learn how to do that, partly because I want to port my Modiin Bus project over to Python too at some point (I discovered that the transit data that I’d like to use is available through Python APIs).

At the same time, I also intend figuring out how to represent fractions in the web interface. I know that’s it’s possible to use Javascript to represent fractions on a web page using options such as math.js and MathJax. I’ll look for equivalent options for Python/Django.

There are also a couple niggling issues about the current version that I’d like to resolve too. These likely exist because I’m still very much a Python newbie.

I’m sure there are other improvements I could make to how the script accepts, and processes input from users. I’ll figure that stuff out as I go. For now, I’m pretty please that this core script seems to be working.

My idea of a good time: coding on a Linux computer

Lately my idea of fun has been firmly rooted in coding, and playing around with Linux.

We’re planning to buy our son a new Linux PC after passing his (and before him, my) old Linux PC to our daughter.

I’m very tempted to extend my loan of my personal MacBook Air to him, and but myself a new laptop to install Linux on, and use that to explore what’s possibly my latest midlife crisis.

This article about Jason Evangelho’s switch to Linux just reinforces my temptation/idea.

Canonical’s Ubuntu seems to command a lot of mindshare when it comes to desktop Linux, so that was my next stop. I went through the same paces: download to a USB stick, boot up to the “Live” version of Ubuntu 18.04 (which includes 5 years of security patches and updates), have a look around, click “Install.” Ubuntu presented me with several options for partitioning the internal SSD, including blasting the entire drive. Tempting! I was feeling lucky so I took the plunge.