Solution

Simplifying Doughnut Neel and Noah

First name
Neel and Noah
School
Heckmondwike Grammar School
School's Twitter handle
@HeckGrammar
Age
16

We started off by simplifying all the algebraic expressions into forms with just A, B and normal operations. Then we manually arranged the cards by finding certain restrictions. We then noticed that the dominoes could be intuitively though of as edges and vertices in a graph with the expressions being vertices and edges being the connections in the doughnut. We then noticed that a doughnut is a bunch of edges (4,8 or 16) that can be traversed without overlap. From this we can find all the doughnuts by finding all the cycles in a directed graph of dominoes of a certain length (4, 8 or 16). We used depth-first search for this (a graph exploration algorithm) to ensure we found all the possible solutions without duplicates. To do this we terminated checking a branch early if it failed the criteria of connecting to form a doughnut. We prevented counting of duplicates by not repeatedly counting rotations or reflections of existing solutions (finding only canonical cycles). Since there are only 16 edges, the sample space is small so we can search all solutions in quite fast times. We have included our written python code which outputs all the solutions, along with our first manual arrangement and a further intuition overview in the attached file. - Neel and Noah