Exemplo n.º 1
0
 public void Clean()
 {
     firstPlayerGM   = new List <GameMove>();
     firstplayerFSP  = null;
     secondPlayerGM  = new List <GameMove>();
     secondplayerFSP = null;
 }
Exemplo n.º 2
0
 public void ReadFromFile()
 {
     try
     {
         using (StreamReader sr = File.OpenText(fileName))
         {
             string line;
             line            = sr.ReadLine();
             firstplayerFSP  = FigureStartingPosition.FromString(line);
             line            = sr.ReadLine();
             secondplayerFSP = FigureStartingPosition.FromString(line);
             bool evenLine = false;
             while ((line = sr.ReadLine()) != null)
             {
                 if (evenLine)
                 {
                     secondPlayerGM.Add(GameMove.FromString(line));
                 }
                 else
                 {
                     firstPlayerGM.Add(GameMove.FromString(line));
                 }
                 evenLine = !evenLine;
             }
         }
     }
     catch (Exception e) { e.ToString(); }
 }
Exemplo n.º 3
0
        public void LogStartingPosition(Player current, string firstFigurePosition, string secondFigurePosition)
        {
            FigureStartingPosition fsp = new FigureStartingPosition {
                First = firstFigurePosition, Second = secondFigurePosition
            };

            if (current == first)
            {
                firstplayerFSP = fsp;
            }
            else if (current == second)
            {
                secondplayerFSP = fsp;
            }
        }
Exemplo n.º 4
0
 public void Invalidate()
 {
     firstplayerFSP = secondplayerFSP = null;
     firstPlayerGM.Clear();
     secondPlayerGM.Clear();
 }