// tick-tack-toe painblock wrapper //todo: overwrite paintblockw with this when we are in "ttt mode" private void paintblockwttt(int x) { //todo: code cleanup & find bug that causes out of bounds & fix ai var tmpc = color; var lp = true; var y = 0; while (lp) { //gefärbte blöcke überspringen; return wenn keine felder mehr frei sind color = 3; if (blockarr[x, y] == 0) { paintblock(x, y); } else if (y == 2) { return; } else { y++; continue; } if (Console.KeyAvailable) { ConsoleKeyInfo key = Console.ReadKey(true); switch (key.Key) { case ConsoleKey.UpArrow: if ((y > 0) && (blockarr[x, y - 1] == 0)) { color = 0; paintblock(x, y); y--; } else if ((y == 2) && (blockarr[x, y - 2] == 0)) { color = 0; paintblock(x, y); y -= 2; } break; case ConsoleKey.DownArrow: if (y < 2 && (blockarr[x, y + 1] == 0)) { color = 0; paintblock(x, y); y++; } else if ((y == 0) && (blockarr[x, y + 2] == 0)) { color = 0; paintblock(x, y); y += 2; } break; case ConsoleKey.Enter: lp = false; color = tmpc; paintblock(x, y); blockarr[x, y] = tmpc; continue; } color = 3; paintblock(x, y); } } color = changeplayer(tmpc); if (GameLogic.check(x, y, blockarr)) { loop = false; } return; }