title: Restrict from moving to X axis (C# Unity)
body: <p>I have this example data</p>
  
  <blockquote>
    <p>Data: P, B, B, T, P</p>
  </blockquote>
  
  <p>So it will be outputted like this</p>
  
  <p><a href="https://i.stack.imgur.com/lt8qc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lt8qc.png" alt="enter image description here"></a></p>
  
  <p>But what is happening to me is this</p>
  
  <p><a href="https://i.stack.imgur.com/Hulvx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Hulvx.png" alt="enter image description here"></a></p>
  
  <p>What I want here is that every tie must not increment to the X axis . How can I obtain that?</p>
  
  <p>Here's what I've tried so far:</p>
  
  <pre><code>string[] scoreboardWinner = new string[] 
  {
      "P  ","B  ","T  ",
      "BP ","B P","B B","BB ",
      "PB ","P B","P P","PP ",
      "TP ","TB ","T P","T B",
      "TTT",
      "BBP","BPB","BPP","BBB",
      "PPB","PBP","PBB","PPP"
  };
  
  private void XandYaxis() {
  
      string[,] table = new string[104, 6];
      string newPreviousValue = "placeholder";
      int xIndex = -1;
      int yIndex = 0;
  
      if (gametable_no == 1)
      {
          for (int i = 0; i &lt; list.Count; i++)
          {
              newString[0] += list[i].r;
          }
  
          string[] newChars = newString[0].Split(',');
  
          if (table.GetLength(0) &lt; xIndex)
          {
              break;
          }
  
          if (result.Equals(newPreviousValue) &amp;&amp; yIndex &lt; table.GetLength(1) - 1)
          {
              yIndex += 1;
              table[xIndex, yIndex] = result;
          }
          else
          {
              xIndex += 1;
              yIndex = 0;
              table[xIndex, yIndex] = result;
          }
       }
  }
  </code></pre>
  
  <p>I also tried putting an if else statement inside of the </p>
  
  <pre><code>if (result.Equals(newPreviousValue) &amp;&amp; yIndex &lt; table.GetLength(1) - 1)
      {
          string newResult = scoreboardWinner[2];
          if (previousValue.Contains(newResult))
          {
              yIndex += 1;
              table[xIndex, yIndex] = result;
          }
       }
  }
  </code></pre>
  
  <p>But it didn't work.</p>
  
  <p>By the way the <code>scoreboardWinner[2]</code> = "T  "; which is the <code>TIE</code></p>