public static GameFile Load(string fileName)
        {
            var text     = System.IO.File.ReadAllText(fileName);
            var gameFile = new GameFile();
            var fileRows = text.Split('\r').ToList();

            gameFile.InitialPosition = fileRows.First();
            fileRows.RemoveAt(0);
            foreach (var row in fileRows)
            {
                if (string.IsNullOrEmpty(row.Trim()))
                {
                    continue;
                }
                gameFile.MoveCommands.Add(MoveCommand.Parse(row.Trim()));
            }
            return(gameFile);
        }
示例#2
0
        internal bool TryStringMove(string command)
        {
            var cmd = MoveCommand.Parse(command);

            return(TryPossibleMoveCommand(cmd));
        }