Exemple #1
0
        // Checks user input for save and saves the current game if requested
        public string SaveGame(string s, Board b, Player p)
        {
            if (String.Equals(s, "save", StringComparison.CurrentCultureIgnoreCase))
            {
                Stream        saveFile   = File.Create("Connect4Save.xml");
                SoapFormatter serializer = new SoapFormatter();
                serializer.Serialize(saveFile, p.getTurnNumber());
                serializer.Serialize(saveFile, b.GetBoard());

                saveFile.Close();
                return("save");
            }
            return(s);
        }