Exemple #1
0
        public void Move(Direction d)
        {
            Position[] movePositions = Game.Move(d);
            View.SetMoves(Game.GetMoveCount());

            foreach (Position p in movePositions)
            {
                View.SetGamePosition(p.Row, p.Column, Game.GetPartAt(p.Row, p.Column));
            }

            if (Game.IsFinished())
            {
                string player    = GetPlayerName();
                string fileName  = Game.GetName();
                string file      = Filer.Load(fileName);
                int    thisScore = Game.GetMoveCount();
                Filer.ReplaceFile(fileName, FM.GetFileWithNewStatInserted(fileName, player, thisScore));
                string[] bestScore = FM.GetBestStat(file).Split('-');
                View.FinishGame(bestScore[0], bestScore[1], thisScore);
            }
        }