Exemple #1
0
        private static bool IsOpen(LineEnumerable line)
        {
            bool[] runs = new bool[] { true, true };
            for (int run = 0; run < 2; run++)
            {
                int     i     = 0;
                SquareT match = SquareT.Empty;
                foreach (var item in line)
                {
                    if (run == 0 ? i == 0 : i == Board.SideLen - 1)
                    {
                        i++;
                        continue;
                    }

                    if (item != SquareT.Empty && match == SquareT.Empty)
                    {
                        match = item;
                    }

                    if (item != SquareT.Empty && item != match)
                    {
                        runs[run] = false;
                        break;
                    }

                    i++;
                }
            }
            return(runs[0] || runs[1]);
        }
Exemple #2
0
 public void Set(int x, int y, SquareT move)
 {
     if (x >= SideLen || y >= SideLen || x < 0 || y < 0)
     {
         throw new IndexOutOfRangeException();
     }
     setBit(x, 2 * y, move != SquareT.Empty);
     setBit(x, 2 * y + 1, move == SquareT.O);
 }
Exemple #3
0
 public void Set(int x, int y, SquareT move)
 {
     array[x, y] = move;
 }
Exemple #4
0
 public void PlayMove(int x, int y, SquareT move)
 {
     board.Set(x, y, move);
 }