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]); }
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); }
public void Set(int x, int y, SquareT move) { array[x, y] = move; }
public void PlayMove(int x, int y, SquareT move) { board.Set(x, y, move); }