title: Too many 'if' statements?
body: <p>The following code does work how I need it to, but it's ugly, excessive or a number of other things. I've looked at formulas and attempted to write a few solutions, but I end up with a similar amount of statements.</p>
  
  <p>Is there a type of math formula that would benefit me in this instance or are 16 if statements acceptable?</p>
  
  <p>To explain the code, it's for a kind of simultaneous-turn-based game.. two players have four action buttons each and the results come from an array (0-3), but the variables 'one' &amp; 'two' can be assigned anything if this helps. The result is, 0 = neither win, 1 = p1 wins, 2 = p2 wins, 3 = both win.</p>
  
  <pre><code>public int fightMath(int one, int two) {
  
      if(one == 0 &amp;&amp; two == 0) { result = 0; }
      else if(one == 0 &amp;&amp; two == 1) { result = 0; }
      else if(one == 0 &amp;&amp; two == 2) { result = 1; }
      else if(one == 0 &amp;&amp; two == 3) { result = 2; }
      else if(one == 1 &amp;&amp; two == 0) { result = 0; }
      else if(one == 1 &amp;&amp; two == 1) { result = 0; }
      else if(one == 1 &amp;&amp; two == 2) { result = 2; }
      else if(one == 1 &amp;&amp; two == 3) { result = 1; }
      else if(one == 2 &amp;&amp; two == 0) { result = 2; }
      else if(one == 2 &amp;&amp; two == 1) { result = 1; }
      else if(one == 2 &amp;&amp; two == 2) { result = 3; }
      else if(one == 2 &amp;&amp; two == 3) { result = 3; }
      else if(one == 3 &amp;&amp; two == 0) { result = 1; }
      else if(one == 3 &amp;&amp; two == 1) { result = 2; }
      else if(one == 3 &amp;&amp; two == 2) { result = 3; }
      else if(one == 3 &amp;&amp; two == 3) { result = 3; }
  
      return result;
  }
  </code></pre>