public void textYaz(oyuncu kullanici) { StreamWriter yaz = new StreamWriter("oyunVerileri.txt"); yaz.WriteLine("İsim: " + kullanici.isim); yaz.WriteLine("Harf: " + kullanici.harf); yaz.WriteLine("Boyut: " + oyunTahtasi.boyut); char[,] dizi = this.oyunTahtasiniAl(); for (int i = 0; i < oyunTahtasi.boyut; i++) { for (int j = 0; j < oyunTahtasi.boyut; j++) { if (dizi[i, j] == 'X' || dizi[i, j] == 'O') { yaz.Write(dizi[i, j] + " "); } else { yaz.Write("- "); } } yaz.WriteLine(); } yaz.Close(); Console.WriteLine("Veriler kayıt edildi."); }
public void oyunTahtasiniYazdir(oyuncu kullanici) { System.Threading.Thread.Sleep(500); Console.Clear(); if (kullanici.oyuncuTurunuAl()) { Console.ForegroundColor = ConsoleColor.Green; } else { Console.ForegroundColor = ConsoleColor.Red; } Console.Write("\n\tİsim: " + kullanici.isim + "\t\t\t Oynadığı Harf: " + kullanici.karakteriAl() + "\t\t Oyuncu Türü: "); Console.WriteLine((!kullanici.oyuncuTurunuAl()) ? "Bilgisayar" : "Kullanıcı"); Console.ForegroundColor = ConsoleColor.White; char[] d = { 'A', 'B', 'C', 'D', 'E', 'F', 'G' }; int i, j; Console.WriteLine("\t\t"); for (i = 0; i < n; i++) { Console.Write("\t\t" + d[i]); } Console.WriteLine(); this.cizgi(); Console.WriteLine(); for (i = 0; i < n; i++) { Console.Write(" " + (i + 1) + "\t"); for (j = 0; j < n; j++) { Console.Write("\t" + tahta[i, j] + "\t"); } Console.WriteLine(); this.cizgi(); Console.WriteLine(); } }
public void nesneOlustur(char harf, string isim) { if (harf == 'X' || harf == 'O' || harf == 'x' || harf == 'o') { kullanici = new oyuncu(true, harf, isim); } else { kullanici = new oyuncu(true, isim); } if (harf == 'O' || harf == 'o') { harf = 'X'; } else { harf = 'O'; } bilgisayar = new oyuncu(false, harf, "Bilgisayar"); }