Mac games
A Time Wasters Compendium

Why this app?

I've never been one for playing games on computers. Back in the day, games were very simple and involved a little bit of thought combined with a little bit of luck. The rules were clear and the objective obvious. Sadly, back then, I was more interested in programming than in playing games.

Fast forward several years and games have moved on significantly, with high resolution graphics, complex story lines and dedicated graphics and sound processors. Unfortunately, for me at least, they have become over complex, requiring many dedicated hours to master. More hours than I am prepared to commit (Though I did manage to complete a couple of platform games on the PS/4).

And so, I find myself hankering for simpler times. Simple games that I can play when I have a spare few minutes and games that I can complete in minutes (with a sense of achievement) rather than hours or days.

Welcome to A Time Wasters Compendium for the Mac.

Key Learning Points

What did I want to achieve?

This is an app well out of my comfort zone. As I may have mentioned, I'm not a gamer, so the prospect of writing games is not something that comes easy. The plan, if I can call it that, is to create an application which can be easily extended to plug in games. The games need to be simple and quick to play.

The aims are simple;

  • A Mac specific app.
  • An engaging home page.
  • Simple games self contained in frameworks.
  • Just for the fun of it, a home page without a title bar.

Acknowledgements

Paul Hudson Hacking with Swift+ live streams .
Sound files ZapSplat.com .
Start page image files pixabay.com .

What it looks like

And the end result is...

The home screen received a fair amount of attention. I may have gone too far, but that's the fun of coding.

Email filtering on the Mac

The opening window has been designed to be based around the background image. I have removed the title bar and the close/max/min icons. For my usage, they serve no purpose. Without the title bar, the window cannot be moved and that is unacceptable. So, I have set the window up to allow it to be moved by dragging the background.

For each game, there is a button. To give the game a little movement, the buttons fade on screen one at a time. When you hover the mouse over a button, the clock face changes to an info icon that can be clicked to display game information.

Email filtering on the Mac

Clicking a button will open the selected game.

Minesweeper

Minesweeper is a classic game from the dim and distant past. The aim of the game is to identify all of the mines without clicking on one and setting it off.

Mine sweeper game

Minesweeper rules are very simple. The board is divided into cells, with mines randomly distributed. To win, you need to open all the cells. The number on a cell shows the number of mines adjacent to it. Using this information, you can determine cells that are safe, and cells that contain mines. Cells suspected of being mines can be marked with a flag.

To win a game of Minesweeper, all non-mine cells must be opened without opening a mine. There is no score, but there is a timer recording the time taken to finish the game. Difficulty can be increased by adding mines or starting with a larger grid. You can do this via the settings panel. Beginner level is usually on an 8x8 or 9x9 board containing 10 mines, Intermediate is usually on a 16x16 board with 40 mines and expert is usually on a 22x22 board with 99 mines; however, you are free to customise board size and mine count.

The original version of this game was produced by Paul Hudson in his Hacking with Swift+ live streams . I've extended the game to include;

  • Variable game play levels.
  • Sound feedback with an irritating ticking sound to add to the tension.
  • End of game success and failure sounds.
  • A game play popover to explain how to play the game.
  • A fair amount of restructuring of the code.

Word Craft

WordCraft is a game where you have to use a limited number of letters to create a word. To make the game more challenging, you will be given a challenge to meet, such as a word with a specific number of letters or a word that starts with a specific letter.

Word craft game

There is no time limit to complete the challenge, but you must meet the challenge and you cannot use the same word more than once.

Letters you use to successfully create a word will be removed from the game board and replaced with a random set of replacement letters.

Like Minesweeper, Word Craft was a project created by Paul Hudson in his Hacking with Swift+ live streams . The game he presented worked well, but left a lovely amount of space for extension.

My extensions to this game were to:

  • Added a keyboard interface so you can select letters using the keyboard rather than clicking them.
  • Sound feedback while playing the game and when old tiles are removed and new tiles added.
  • An optional log of used words so you can see words you have used before.
  • An optional preview of the word you are creating.
  • Popup feedback when you fail the game rule.
  • The ability to refresh the rule if it is too difficult.
  • A restart game button.
  • A game play popover to explain how to play the game.
  • Some restructuring of the code.

Snake Game

This is a classic game from the early days of computing. The premis is very simple but game play is surprisingly difficult the longer you play.

Snake game

Your job is to guide the snake towards it's food. The snake will grow longer as it eats food. If it touches the borders or itself, it will die. As the game progresses and the snake grows longer and longer, you will need to work out routes to the food that will not cause the snake to die.

The game is very addictive and can be played for hours. It is a great way to spend a few minutes.

Pyramid of Doom Adventure Game

Decades ago, when I was coding in Z80 assembler on the TRS-80, Scott Adams created some text adventure games. None of your fancy graphics here - you type commands, they get interpreted and the console updates with the results. The original code was written in C and has been stable for a very long time. As far as I know, nothing has happened to it in all that time.

This is my variant, written in Swift/SwiftUI. It took a long time to translate the original C code to Swift and a lot of debugging to makwe sure I was loading the original game files correctly. The result is Pyramid of Doom:

Snake game

Number Combinations Game

Number Combinations is a pretty straight forward game. Given four numbers and a result, work out the formula you need to generate the result. you must use all four digits and you can use + - * or / operators to achieve the result. You can force the order of calculation using brackets if you need to.

Number Combinations Game screen

There is an option to display the formula if you're really stuck.

The main failing of the game at the moment is that divisions are integer divisions so, dividing 3 by 2 results in 1. This isn't ideal and can be used to solve most formulae. I want to address this at some point, but it's not a priority right now.

Where is it?

Can I have a copy?

The code is available in my Time Wasters GitHub repo. It's a work in progress project that I plan to add more games to over time.

Testimonials
Testimonials

Am I really any good?

Don't take my word for my abilities, take a look at other peoples opinions about me.