static void beolvas(GridModel table) { string[] proba = File.ReadAllLines("Test.txt"); for (int i = 0; i < proba.Length; i++) { for (int j = 0; j < proba[i].Length; j++) { switch (proba[i][j]) { case '0': table.MakeMove(i, j, FieldState.None); break; case '1': table.MakeMove(i, j, FieldState.PlayerOne); break; case '2': table.MakeMove(i, j, FieldState.PlayerTwo); break; case '3': table.MakeMove(i, j, FieldState.PlayerThree); break; case '4': table.MakeMove(i, j, FieldState.PlayerFour); break; } } } }
static void Main(string[] args) { GridModel table = new GridModel(20, 20); int players, px, py; bool end = false; FieldState CPU = FieldState.None; Console.WriteLine("Add meg a játékosok számát! (minimum 2, maximum 4)"); do { players = Convert.ToInt32(Console.ReadLine()); } while ((players < 2) || (players > 4)); do { do { kiir(table); Console.WriteLine("Add meg annak a sornak és oszlopnak a számát, ahová lépésedet helyezni szeretnéd!"); Console.WriteLine("(Kettő külön sorba add meg az értékeket!)"); px = Convert.ToInt32(Console.ReadLine()); py = Convert.ToInt32(Console.ReadLine()); } while (table.MakeMove(px, py, FieldState.PlayerOne) == false); end = GameEnd(table, px, py, 5); for (int i = 0; i < players - 1; i++) { switch (i) { case 0: CPU = FieldState.PlayerTwo; break; case 1: CPU = FieldState.PlayerThree; break; case 2: CPU = FieldState.PlayerFour; break; } AI(table, CPU, ref px, ref py, players); table.MakeMove(px, py, CPU); end = GameEnd(table, px, py, 5); } } while (end == false); }