title: If(), else if() alternative in c++(Is this AI?)
body: <p>First off, I am a noob. I am also a Janitor that has never made a dime writing code. This is just something that I love doing. It is for fun:) That being said, I wrote this console based tic-tak-toe game that has enough ai to not lose every game. (I guess ai is what it should be called.) It has something like 70 if/else if statements for the computers turn. I used 3 int arrays like so:</p>
  
  <pre><code>int L[2], M[2], R[2];
  </code></pre>
  
  <p>0 = blank;
  1 = X;
  2 = O;<br>
  The board then 'Looks' like<br>L[0] | M[0] | R[0]<br>L[1] | M[1] | R[1]<br>L[2] | M[2] | R[2]<br></p>
  
  <p>So I basically wrote out every possible scenario I could think something like:</p>
  
  <pre><code>if(M[0]==1 &amp; M[1]==1 &amp; M[2]==0){M[2] = 2;}//here the computer prevents a win 
  else if(L[0] ==2&amp;M[1]==2&amp;R[2]==0){R[2]=2;}//here the computer wins
  //and so on....68 more times!
  </code></pre>
  
  <p>I guess my question(s) is(are): <br>Is there a better way?<br> Is there a way to achieve the same result with less lines of code?<br>Is this considered Artificial Intelligence? </p>