-
I discovered a bug in the game I had written on Tic Tac Toe. When the board is in a certain state, the system did not take the obvious winning move. It still won the game, but with an extra move required. This article details how to write a failing unit test to reproduce the issue and how to update the minimax …
Read More -
This is the fourth part in this trilogy! - with a brief interlude last week for an introduction to the Minimax algorithm. This article builds on the App from part 1 and 2, which allows two players to play Tic Tac Toe. In this article we will implement the minimax algorithm to determin the best move for the computer to …
Read More -
This creates the View for Tic Tac Toe app utilising the Model and ViewModel created in part 1. More unit tests are added as functionality is required and then the code to get the tests to pass is implemented.
Read More -
Test Driven Development is a process of writing unit tests for software before writing the code to get those tests to pass. Many of us struggle to write the tests before we write the software, but this has gotten easier in Xcode over the years. This article demonstrate an approach for implementing a simple version of …
Read More -
I just couldn't let the Monty Hall problem go. What if there were more doors in the problem. In this article I create a simulation of anywhere from 3 to 6 doors with the underlying premise that after selecting a door, all but one of the remaining doors are opened. The contestant is then offered an option to switch …
Read More -
Monty Hall Problem in SwiftUI - Simulation. An SwiftUI app was developed for the Monty Hall problem and is described in part 1. The solution to the problem is that the contestant should always switch doors when the host opens the door to reveal a goat and offers the contestant the option to switch doors. This article …
Read More -
I love the Monty Hall problem, even though I find it counter-intuitive. The Monty Hall problem is a form of probability puzzle named after American game show host Monty Hall. It is presented in the style of the game show, called Let's Make a Deal, where you are given a choice of selecting one of three doors. Behind one …
Read More -
Model-View-ViewModel (MVVM) is a design pattern used to separate the user interface from the business logic in an application. A simple game is used to demonstrate the three components of MVVM in SwiftUI. MVVM consists of; a Model that contains the data and business logic; a View that presents data to the user and …
Read More