title: Algorithm that can compute values of variables based on the result of specific sums of those
body: <p>This might be a duplicate question, but I wasn't able to find this on stack overflow.</p>
  
  <p>Take some variables, which all represent a chance of something. That means that all variables have a value between zero and one (both inclusive). The values of these are unknown. However, I have some equations with some or all of these variables of which the result is known.</p>
  
  <p>For example, take the variables <code>a</code>, <code>b</code>, <code>c</code>, <code>x</code> and <code>y</code>. Their values are all an unknown number between 0 and 1 (both inclusive). I have the following equations:</p>
  
  <pre><code>1: a + b + c = 1
  2: a + b + x = 2
  3: b + c + y = 2
  4: a + x &lt;= 1    -&gt;    0 &lt;= a + x &lt;= 1
  5: c + y &lt;= 1    -&gt;    0 &lt;= c + y &lt;= 1
  </code></pre>
  
  <p>Solving this gives the following result:</p>
  
  <pre><code>2: a + x + b = 2
     (something between 0 and 1) + b = 2
     b = 2 - (something between 0 and 1)
     1 &lt;= b &lt;= 2
     b = 1 (since 0 &lt;= b &lt;= 1 applies too)
  
  1: a + b + c = 1
     a + 1 + c = 1
     a + c = 0
     a = -c
     a = 0  (since 0 &lt;= a &lt;= 1 and 0 &lt;= c &lt;= 1 apply)
     c = 0
  
  2: a + b + x = 2   |   3: b + c + y = 2
     0 + 1 + x = 2   |      1 + 0 + y = 2
     x = 1           |      y = 1
  
  -&gt; a = 0, b = 1, c = 0, x = 1 and y = 1
  </code></pre>
  
  <p>I solved this on paper, my actual purpose was to prove the following minesweeper situation by assigning each unrevealed cell a variable, respectively <code>x a b c y</code>. Since <code>x</code>, <code>y</code> and <code>b</code> turn out to be one, they could be flagged:</p>
  
  <p><a href="https://i.stack.imgur.com/XUg5R.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XUg5R.png" alt="Minesweeper 2"></a></p>
  
  <p>My general purpose is to solve minesweeper boards using this technique, but it could be used in other software. However, if I want a computer to solve a minesweeper board using this technique, a comupter has to use an algorithm for solving such situations with any amount of variables and any amount of equations. Is there a general algorithm that does this? And if there is, how should I implement that algorithm?</p>
  
  <blockquote>
    <p><strong>To make things obvious</strong></p>
    
    <ul>
    <li>An equation is one variable or a sum of some variables, having a limited  or constant result, which is always positive.</li>
    <li>A variable is an unknown value between zero and one (both inclusive).</li>
    <li>The algorithm takes in the amount of variables with the respective variable names, and the equations that define some variables.</li>
    <li>The algorithm tries to compute as many values as possible. Values that could not be determined remain undetermined.</li>
    </ul>
  </blockquote>