Othello news

Solutions to WOF's Endgame Puzzles

21 June 2025
Written by Jonathan Cerf

I've been enjoying the endgame puzzles that are published daily on the worldothello.org website.  Some of these are relatively easy, but I have found many others to be quite challenging.  No solutions to any of these puzzles are ever published, and I think that's a shame.  You can learn a lot about endgame play from these puzzles.  But it's difficult to learn anything from a particular puzzle if you can't find a solution.  I've written a program in the computer language Python to address this problem.  It prints out a solution for any WOF endgame puzzle.  All of the resources that anyone would need to run my program are available for free on the internet, and later in this article, I will share my program's source code.  This means that anyone who is occasionally frustrated by a WOF puzzle will from now on have access to the puzzle's solution.  But before I explain how to set up your computer to run my program, I will explain how to "read" its output.

Here is a puzzle that appeared recently on the WOF website:

SWEP_Puzzle1.png

And here is my program's "solution" to the above puzzle:

SWEP_Solution1.png

If you attempt to solve one of the daily endgame puzzles interactively on the internet, your computer opponent will select a single response to each of your moves.   But along the way, your computer-generated opponent may well have had options that it rejected in favor of the moves it chose to make.  My program does not know which option your computer-generated opponent will select.  Therefore, all of the computer's possible choices are included in my program's "solution."  If you had used my program's output for the puzzle shown above while playing against the on-screen computer opponent, you should have begun by playing to a8, because every winning line of play in my program's output begins with a move to a8.  Your computer opponent would then have responded by playing to h2 as shown below:

SWEP_Puzzle2.png

Only four lines of my program's solution reflect this particular choice by your computer opponent.  Those four lines are highlighted in blue below.  In each of those four lines, my program indicates that a winning response to the computer's h2 move would be a move to f1:

SWEP_Solution2.png

If you had followed my program's recommendation and moved to f1, the computer would have chosen to respond by moving to g8.  Only two lines of text in my program's output reflect this choice, and those lines are shown highlighted in blue below:

SWEP_Solution3.png

In each of the two highlighted lines of text shown above, my program shows that a winning response to the computer's g8 move would be a move by White to a7.   If you were playing out this endgame puzzle as White on the internet, your computer opponent would have responded to your a7 move by playing at a1, producing the position shown below:

SWEP_Puzzle3.png

Only one line of text in my program's output reflects the full line of play jointly selected by you and your computer opponent up to this point.  That single line of text is shown highlighted in blue below:

SWEP_Solution4.png

As indicated in the highlighted line of text above, a winning response to the computer's most recent move to a1 would have been a White move to g7.  The computer would then have had only one possible move (to h8).  White could then have played to the only remaining vacant square (at a2), producing the position shown below:

SWEP_Puzzle4.png

Although only one line of text from my program's output reflects the correct way to achieve a win against your online computer opponent, that one line of text alone would not suffice as a "solution" to the original puzzle.  A full solution should take into account every possible line of defense.  It should not merely suggest a single series of winning plays against the particular defensive moves chosen by a given opponent.  Incidentally, my program does not attempt to maximize its margin of victory.  In situations where there may be more than one winning move, it settles for the first move it discovers that leads to a sure victory, completely ignoring the possibility that a different move might produce a more impressive win.

Here is how to install and run my program.  It will run on either an Apple or on a Windows-based machine.  The installation process is a bit cumbersome, but it only needs to be done once.  After that, you can run my program as often as you like without repeating the installation procedure.   To install my program, you will first of all need a relatively up-to-date version of the Python computer language that is suitable for your computer's operating system.  Python is available free of charge from Python.org.  After installing Python, you will need to install Python's "requests" module.  Installing this module is probably the trickiest step in the whole operation.  To install "requests" you will need to go to your "Terminal" window and type in one of two possible commands (depending upon which version of Python you have installed).  The wrong command will do no harm, but neither will it do any good.   If you have trouble either opening a "Terminal" window or running one of the "pip" commands shown below, Google can provide help. Here are the two possible commands:

    pip install requests

or:

   pip3 install requests

You should next download the file containing my code, which can be found here.  The file is called “PuzzleSolver.txt.”  After you download it, move it to an easy-to-find folder on your computer (such as your Documents folder).  Then change its name from “PuzzleSolver.txt” to “PuzzleSolver.py” (I have given it the temporary name “PuzzleSolver.txt” only because many computers for security reasons are not comfortable letting you download a file having a “.py” extension).

You should probably install a Python IDE.  I recommend Visual Studio Code, which is available on the internet free of charge (from https://code.visualstudio.com/download).  It is possible to run Python programs directly from your Terminal window without using an IDE, but you are likely to have an easier time if you use an IDE.  After you have installed an IDE, fire it up and direct it to open the file containing my code: Puzzle Solver.py.  In part because of the file’s “.py” extension, your IDE should immediately recognize the plain text inside this file as Python code.  You should then be able to click on the IDE’s “run” icon (in the case of Visual Studio Code, the “run” icon is a right-facing arrow near the upper right corner of the screen).  Probably, you will need to scroll or enlarge the output portion of your screen to see the full text of my program’s puzzle solution.  It is possible that you could encounter a problem if you have more than one version of Python installed on your computer.  In that case you will need to make sure that your IDE is using the version of Python in which you have installed the "requests" module.

Whenever you run my program, it will analyze the puzzle that is at that time being displayed on the WOF website.  If you run my program today, it will proceed to analyze today's puzzle.  If you run my code tomorrow, it will analyze tomorrow's puzzle.   I have not included any explanatory comments in my code, but I will gladly respond to any questions about how it works or any questions about how to install and run it.  You can get in touch with me through the "Contact" menu option on the home screen of my arithmetic website, AdventuresInArithmetic.com.