Пример #1
0
 private bool LetztesFeld()
 {
     if (Spielfeld.Any(x => x.Typ == FeldTyp.Leer))
     {
         return(false);
     }
     return(true);
 }
Пример #2
0
        private bool VersucheZuSetzen()
        {
            if (FeldIstLeer())
            {
                Spielfeld.First(x => x.xCoordinate == cursorX && x.yCoordinate == cursorY).Typ
                    = Spieler.First(x => x.MeinZug).Zeichen.ToLower()
                      == "x" ? FeldTyp.X : FeldTyp.O;

                return(true);
            }
            return(false);
        }
Пример #3
0
        private void Start()
        {
            Spielfeld = new Spielfeld();
            Spieler   = new List <Spieler>();
            Spieler.Add(new Spieler("X", true));
            Spieler.Add(new Spieler("O"));

            ZeichneSpielfeld();
            Feldauswahl();
            if (NeustartInitiieren())
            {
                Start();
            }
        }
Пример #4
0
 private bool DreiInEinerReihe()
 {
     for (int i = 0; i < 3; i++)
     {
         List <Feld> felder = Spielfeld.Where(x => x.yCoordinate == i).ToList();
         if (!felder.Any(x => x.Typ == FeldTyp.Leer))
         {
             if (felder[0].Typ == felder[1].Typ && felder[0].Typ == felder[2].Typ)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
Пример #5
0
        private bool DreiInEinerDiagonale()
        {
            if
            (
                Spielfeld.First(x => x.xCoordinate == 0 && x.yCoordinate == 0).Typ != FeldTyp.Leer &&
                Spielfeld.First(x => x.xCoordinate == 0 && x.yCoordinate == 0).Typ == Spielfeld.First(x => x.xCoordinate == 1 && x.yCoordinate == 1).Typ&&
                Spielfeld.First(x => x.xCoordinate == 0 && x.yCoordinate == 0).Typ == Spielfeld.First(x => x.xCoordinate == 2 && x.yCoordinate == 2).Typ
            )
            {
                return(true);
            }
            else if
            (
                Spielfeld.First(x => x.xCoordinate == 2 && x.yCoordinate == 0).Typ != FeldTyp.Leer &&
                Spielfeld.First(x => x.xCoordinate == 2 && x.yCoordinate == 0).Typ == Spielfeld.First(x => x.xCoordinate == 1 && x.yCoordinate == 1).Typ&&
                Spielfeld.First(x => x.xCoordinate == 2 && x.yCoordinate == 0).Typ == Spielfeld.First(x => x.xCoordinate == 0 && x.yCoordinate == 2).Typ
            )
            {
                return(true);
            }

            return(false);
        }
Пример #6
0
 private bool FeldIstLeer()
 {
     return(Spielfeld.First(x => x.xCoordinate == cursorX && x.yCoordinate == cursorY).Typ == FeldTyp.Leer);
 }