<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Processing Instruction generated by Amaya; the stylesheet is
     available on the W3C site at http://www.w3.org/Math/XSL/pmathml.xsl -->
<?xml-stylesheet type="text/xsl" href="http://www.w3.org/Math/XSL/pmathml.xsl"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"
      "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>PGMS Equation Strategy</title>
  <meta name="generator" content="amaya 7.2+, see http://www.w3.org/Amaya/" />
</head>

<body>
<p>
[<a href="eqnexpert.html">Expert Game using the Equation Strategy</a>]
[<a href="mioexpert.html">Expert Game using the Mio Equation Strategy</a>]
</p>

<h1>The PGMS Equation Strategy</h1>

<p>The PGMS Equation Strategy represents the information available on the
board as a set of integer linear equations. Associated with an unknown
tile&nbsp;<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline">
  <mi>t</mi>
</math>
 is a variable&nbsp;<math xmlns="http://www.w3.org/1998/Math/MathML"
display="inline">
  <msub>
    <mi>x</mi>
    <mi>t</mi>
  </msub>
</math>
 that has the value one if the tile hides a mine, or zero otherwise.</p>

<p>An equation is generated for each known tile with an adjacent unknown
tile. Each equation has the form&nbsp;<math
xmlns="http://www.w3.org/1998/Math/MathML" display="inline">
  <mi>c</mi>
  <mo>=</mo>
  <mrow>
    <munder>
      <mo>&sum;</mo>
      <mrow>
        <mi>t</mi>
        <mo>&isin;</mo>
        <mi>S</mi>
      </mrow>
    </munder>
    <mo>&InvisibleTimes;</mo>
    <msub>
      <mi>x</mi>
      <mi>t</mi>
    </msub>
  </mrow>
</math>
 where&nbsp;<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline">
  <mi>S</mi>
</math>
 is a set of unknown tiles, and&nbsp;<math
xmlns="http://www.w3.org/1998/Math/MathML" display="inline">
  <mi>c</mi>
</math>
 is a constant indicating the number of mines hidden among&nbsp;<math
xmlns="http://www.w3.org/1998/Math/MathML" display="inline">
  <mi>S</mi>
</math>.
 To simplify notation, the equation is written as&nbsp;<math
xmlns="http://www.w3.org/1998/Math/MathML" display="inline">
  <mi>c</mi>
  <mo>&circeq;</mo>
  <mi>S</mi>
</math>.
</p>

<p>Since the total number of hidden mines is known, an additional equation
simply equates this number with the sum of all of the unknown tiles. For
performance reasons, this equation is used only when there are eight or less
unknown mines, or when guessing.</p>

<p>Every time a tile&nbsp;<math xmlns="http://www.w3.org/1998/Math/MathML"
display="inline">
  <mi>t</mi>
</math>
 is determined safe or a mine, the board changes are propagated to all the
equations containing&nbsp;<math xmlns="http://www.w3.org/1998/Math/MathML"
display="inline">
  <mi>t</mi>
</math>
 and a new equation for the unknown neighbors of&nbsp;<math
xmlns="http://www.w3.org/1998/Math/MathML" display="inline">
  <mi>t</mi>
</math>
 is added. To determine whether tiles are safe or a mine, the Equation
Strategy iteratively applies the following rules until none are
applicable:</p>
<ul>
  <li>If&nbsp;<math xmlns="http://www.w3.org/1998/Math/MathML"
    display="inline">
      <mn>0</mn>
      <mo>&circeq;</mo>
      <mi>S</mi>
    </math>,
 all tiles in&nbsp;<math xmlns="http://www.w3.org/1998/Math/MathML"
    display="inline">
      <mi>S</mi>
    </math>
     are safe.</li>
  <li>If&nbsp;<math xmlns="http://www.w3.org/1998/Math/MathML"
    display="inline">
      <mi>c</mi>
      <mo>&circeq;</mo>
      <mi>S</mi>
    </math>
     and&nbsp;<math xmlns="http://www.w3.org/1998/Math/MathML"
    display="inline">
      <mi>c</mi>
      <mo>=</mo>
      <mfenced open="|" close="|">
        <mi>S</mi>
      </mfenced>
    </math>,
 all tiles in&nbsp;<math xmlns="http://www.w3.org/1998/Math/MathML"
    display="inline">
      <mi>S</mi>
    </math>
     are a mine.</li>
  <li>If&nbsp;<math xmlns="http://www.w3.org/1998/Math/MathML"
    display="inline">
      <msub>
        <mi>c</mi>
        <mn>0</mn>
      </msub>
      <mo>&circeq;</mo>
      <msub>
        <mi>S</mi>
        <mn>0</mn>
      </msub>
    </math>
     and&nbsp;<math xmlns="http://www.w3.org/1998/Math/MathML"
    display="inline">
      <msub>
        <mi>c</mi>
        <mn>1</mn>
      </msub>
      <mo>&circeq;</mo>
      <msub>
        <mi>S</mi>
        <mn>1</mn>
      </msub>
    </math>
     are two equations such that&nbsp;<math
    xmlns="http://www.w3.org/1998/Math/MathML" display="inline">
      <msub>
        <mi>S</mi>
        <mn>0</mn>
      </msub>
    </math>
     is a proper subset of&nbsp;<math
    xmlns="http://www.w3.org/1998/Math/MathML" display="inline">
      <msub>
        <mi>S</mi>
        <mn>1</mn>
      </msub>
    </math>,
 the equation&nbsp;<math xmlns="http://www.w3.org/1998/Math/MathML"
    display="inline">
      <mrow>
        <msub>
          <mi>c</mi>
          <mn>1</mn>
        </msub>
        <mo>-</mo>
        <msub>
          <mi>c</mi>
          <mn>0</mn>
        </msub>
      </mrow>
      <mo>&circeq;</mo>
      <mrow>
        <msub>
          <mi>S</mi>
          <mn>1</mn>
        </msub>
        <mo>&setminus;</mo>
        <msub>
          <mi>S</mi>
          <mn>0</mn>
        </msub>
      </mrow>
    </math>
     is added.</li>
  <li>Let&nbsp;<math xmlns="http://www.w3.org/1998/Math/MathML"
    display="inline">
      <msub>
        <mi>c</mi>
        <mn>0</mn>
      </msub>
      <mo>&circeq;</mo>
      <msub>
        <mi>S</mi>
        <mn>0</mn>
      </msub>
    </math>
     and&nbsp;<math xmlns="http://www.w3.org/1998/Math/MathML"
    display="inline">
      <msub>
        <mi>c</mi>
        <mn>1</mn>
      </msub>
      <mo>&circeq;</mo>
      <msub>
        <mi>S</mi>
        <mn>1</mn>
      </msub>
    </math>
     be two equations such&nbsp;<math
    xmlns="http://www.w3.org/1998/Math/MathML" display="inline">
      <msub>
        <mi>c</mi>
        <mn>0</mn>
      </msub>
      <mo>&lt;</mo>
      <msub>
        <mi>c</mi>
        <mn>1</mn>
      </msub>
    </math>.
 The difference between the two equations is&nbsp;<math
    xmlns="http://www.w3.org/1998/Math/MathML" display="inline">
      <mrow>
        <msub>
          <mi>c</mi>
          <mn>1</mn>
        </msub>
        <mo>-</mo>
        <msub>
          <mi>c</mi>
          <mn>0</mn>
        </msub>
      </mrow>
      <mo>&circeq;</mo>
      <mrow>
        <mfenced>
          <mrow>
            <msub>
              <mi>S</mi>
              <mn>1</mn>
            </msub>
            <mo>&setminus;</mo>
            <msub>
              <mi>S</mi>
              <mn>0</mn>
            </msub>
          </mrow>
        </mfenced>
        <mo>-</mo>
        <mfenced>
          <mrow>
            <msub>
              <mi>S</mi>
              <mn>0</mn>
            </msub>
            <mo>&setminus;</mo>
            <msub>
              <mi>S</mi>
              <mn>1</mn>
            </msub>
          </mrow>
        </mfenced>
      </mrow>
    </math>.
 If&nbsp;<math xmlns="http://www.w3.org/1998/Math/MathML"
    display="inline">
      <mrow>
        <msub>
          <mi>c</mi>
          <mn>1</mn>
        </msub>
        <mo>-</mo>
        <msub>
          <mi>c</mi>
          <mn>0</mn>
        </msub>
      </mrow>
      <mo>=</mo>
      <mfenced open="|" close="|">
        <mrow>
          <msub>
            <mi>S</mi>
            <mn>1</mn>
          </msub>
          <mo>&setminus;</mo>
          <msub>
            <mi>S</mi>
            <mn>0</mn>
          </msub>
        </mrow>
      </mfenced>
    </math>,
 all the tiles in&nbsp;<math xmlns="http://www.w3.org/1998/Math/MathML"
    display="inline">
      <mfenced>
        <mrow>
          <msub>
            <mi>S</mi>
            <mn>1</mn>
          </msub>
          <mo>&setminus;</mo>
          <msub>
            <mi>S</mi>
            <mn>0</mn>
          </msub>
        </mrow>
      </mfenced>
    </math>
     are a mine and all the tiles in&nbsp;<math
    xmlns="http://www.w3.org/1998/Math/MathML" display="inline">
      <mfenced>
        <mrow>
          <msub>
            <mi>S</mi>
            <mn>0</mn>
          </msub>
          <mo>&setminus;</mo>
          <msub>
            <mi>S</mi>
            <mn>1</mn>
          </msub>
        </mrow>
      </mfenced>
    </math>
     are safe. This rule is useful only when&nbsp;<math
    xmlns="http://www.w3.org/1998/Math/MathML" display="inline">
      <msub>
        <mi>S</mi>
        <mn>0</mn>
      </msub>
    </math>
     and&nbsp;<math xmlns="http://www.w3.org/1998/Math/MathML"
    display="inline">
      <msub>
        <mi>S</mi>
        <mn>1</mn>
      </msub>
    </math>
     share a tile.</li>
</ul>

<p>The Equations Strategy must guess when presented with a board to which
none of the rules apply. The Equation Strategy inspects each equation when
guessing. For each tile&nbsp;<math xmlns="http://www.w3.org/1998/Math/MathML"
display="inline">
  <mi>t</mi>
</math>
 it computes the value&nbsp;<math xmlns="http://www.w3.org/1998/Math/MathML"
display="inline">
  <mi>P</mi>
  <mo>&ApplyFunction;</mo>
  <mfenced>
    <mi>t</mi>
  </mfenced>
</math>
 as follows. Given an equation&nbsp;<math
xmlns="http://www.w3.org/1998/Math/MathML" display="inline">
  <mi>c</mi>
  <mo>&circeq;</mo>
  <mi>S</mi>
</math>,
 define its single equation probability to be&nbsp;<math
xmlns="http://www.w3.org/1998/Math/MathML" display="inline">
  <mi>c</mi>
  <mo>/</mo>
  <mfenced open="|" close="|">
    <mi>S</mi>
  </mfenced>
</math>.
 The value <math xmlns="http://www.w3.org/1998/Math/MathML" display="inline">
  <mi>P</mi>
  <mo>&ApplyFunction;</mo>
  <mfenced>
    <mi>t</mi>
  </mfenced>
</math>
 is largest single equation probability among all equations that
contain&nbsp;<math xmlns="http://www.w3.org/1998/Math/MathML"
display="inline">
  <mi>t</mi>
</math>.
 The Equation Strategy picks the tile&nbsp;<math
xmlns="http://www.w3.org/1998/Math/MathML" display="inline">
  <mi>t</mi>
</math>
 that minimizes&nbsp;<math xmlns="http://www.w3.org/1998/Math/MathML"
display="inline">
  <mi>P</mi>
  <mo>&ApplyFunction;</mo>
  <mfenced>
    <mi>t</mi>
  </mfenced>
</math>
 and then applies the rules listed above. A random choice is made when there
is more than one tile that minimizes&nbsp;<math
xmlns="http://www.w3.org/1998/Math/MathML" display="inline">
  <mi>P</mi>
  <mo>&ApplyFunction;</mo>
  <mfenced>
    <mi>t</mi>
  </mfenced>
</math>.
</p>

<p>The Mio inspired modification to the Equation Strategy adds one more rule.
Let&nbsp;<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline">
  <msub>
    <mi>c</mi>
    <mn>0</mn>
  </msub>
  <mo>&circeq;</mo>
  <msub>
    <mi>S</mi>
    <mn>0</mn>
  </msub>
</math>,
 &nbsp;<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline">
  <msub>
    <mi>c</mi>
    <mn>1</mn>
  </msub>
  <mo>&circeq;</mo>
  <msub>
    <mi>S</mi>
    <mn>1</mn>
  </msub>
</math>,
 and&nbsp;<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline">
  <msub>
    <mi>c</mi>
    <mn>2</mn>
  </msub>
  <mo>&circeq;</mo>
  <msub>
    <mi>S</mi>
    <mn>2</mn>
  </msub>
</math>
 be three equations such&nbsp;<math
xmlns="http://www.w3.org/1998/Math/MathML" display="inline">
  <mrow>
    <msub>
      <mi>c</mi>
      <mn>0</mn>
    </msub>
    <mo>+</mo>
    <msub>
      <mi>c</mi>
      <mn>1</mn>
    </msub>
  </mrow>
  <mo>&lt;</mo>
  <msub>
    <mi>c</mi>
    <mn>2</mn>
  </msub>
</math>.
 The combined equation is&nbsp;<math
xmlns="http://www.w3.org/1998/Math/MathML" display="inline">
  <mrow>
    <msub>
      <mi>c</mi>
      <mn>2</mn>
    </msub>
    <mo>-</mo>
    <msub>
      <mi>c</mi>
      <mn>1</mn>
    </msub>
    <mo>-</mo>
    <msub>
      <mi>c</mi>
      <mn>0</mn>
    </msub>
  </mrow>
  <mo>&circeq;</mo>
  <mrow>
    <mfenced>
      <mrow>
        <msub>
          <mi>S</mi>
          <mn>2</mn>
        </msub>
        <mo>&setminus;</mo>
        <mfenced>
          <mrow>
            <msub>
              <mi>S</mi>
              <mn>1</mn>
            </msub>
            <mo>&cup;</mo>
            <msub>
              <mi>S</mi>
              <mn>0</mn>
            </msub>
          </mrow>
        </mfenced>
      </mrow>
    </mfenced>
    <mo>-</mo>
    <mfenced>
      <mrow>
        <mfenced>
          <mrow>
            <msub>
              <mi>S</mi>
              <mn>1</mn>
            </msub>
            <mo>&cup;</mo>
            <msub>
              <mi>S</mi>
              <mn>0</mn>
            </msub>
          </mrow>
        </mfenced>
        <mo>&setminus;</mo>
        <msub>
          <mi>S</mi>
          <mn>2</mn>
        </msub>
      </mrow>
    </mfenced>
    <mo>-</mo>
    <mfenced>
      <mrow>
        <msub>
          <mi>S</mi>
          <mn>1</mn>
        </msub>
        <mo>&cap;</mo>
        <msub>
          <mi>S</mi>
          <mn>0</mn>
        </msub>
      </mrow>
    </mfenced>
  </mrow>
</math>.
 If&nbsp;<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline">
  <mrow>
    <msub>
      <mi>c</mi>
      <mn>2</mn>
    </msub>
    <mo>-</mo>
    <msub>
      <mi>c</mi>
      <mn>1</mn>
    </msub>
    <mo>-</mo>
    <msub>
      <mi>c</mi>
      <mn>0</mn>
    </msub>
  </mrow>
  <mo>=</mo>
  <mfenced open="|" close="|">
    <mrow>
      <msub>
        <mi>S</mi>
        <mn>2</mn>
      </msub>
      <mo>&setminus;</mo>
      <mfenced>
        <mrow>
          <msub>
            <mi>S</mi>
            <mn>1</mn>
          </msub>
          <mo>&cup;</mo>
          <msub>
            <mi>S</mi>
            <mn>0</mn>
          </msub>
        </mrow>
      </mfenced>
    </mrow>
  </mfenced>
</math>,
 all the tiles in&nbsp;<math xmlns="http://www.w3.org/1998/Math/MathML"
display="inline">
  <mfenced>
    <mrow>
      <msub>
        <mi>S</mi>
        <mn>2</mn>
      </msub>
      <mo>&setminus;</mo>
      <mfenced>
        <mrow>
          <msub>
            <mi>S</mi>
            <mn>1</mn>
          </msub>
          <mo>&cup;</mo>
          <msub>
            <mi>S</mi>
            <mn>0</mn>
          </msub>
        </mrow>
      </mfenced>
    </mrow>
  </mfenced>
</math>
 are a mine and all the tiles in&nbsp;<math
xmlns="http://www.w3.org/1998/Math/MathML" display="inline">
  <mfenced>
    <mrow>
      <mfenced>
        <mrow>
          <msub>
            <mi>S</mi>
            <mn>1</mn>
          </msub>
          <mo>&cup;</mo>
          <msub>
            <mi>S</mi>
            <mn>0</mn>
          </msub>
        </mrow>
      </mfenced>
      <mo>&setminus;</mo>
      <msub>
        <mi>S</mi>
        <mn>2</mn>
      </msub>
    </mrow>
  </mfenced>
  <mo>&cup;</mo>
  <mfenced>
    <mrow>
      <msub>
        <mi>S</mi>
        <mn>1</mn>
      </msub>
      <mo>&cap;</mo>
      <msub>
        <mi>S</mi>
        <mn>0</mn>
      </msub>
    </mrow>
  </mfenced>
</math>
 are safe. This rule is useful only when&nbsp;<math
xmlns="http://www.w3.org/1998/Math/MathML" display="inline">
  <msub>
    <mi>S</mi>
    <mn>0</mn>
  </msub>
</math>
 and&nbsp;<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline">
  <msub>
    <mi>S</mi>
    <mn>2</mn>
  </msub>
</math>
 share a tile, and&nbsp;<math xmlns="http://www.w3.org/1998/Math/MathML"
display="inline">
  <msub>
    <mi>S</mi>
    <mn>1</mn>
  </msub>
</math>
 and&nbsp;<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline">
  <msub>
    <mi>S</mi>
    <mn>2</mn>
  </msub>
</math>
 share a different tile.</p>
</body>
</html>
