Пример #1
1
 public void AddTest()
 {
     Scoreboard target = new Scoreboard();
     string fileName = "AddTest.txt";
     Player player = new Player();
     player.Name = "nakov";
     player.Points = 10;
     target.Add(fileName, player);
 }
Пример #2
1
        public void ShowTest()
        {
            Scoreboard target = new Scoreboard();
            string fileName = "ShowTest.txt";
            Player player = new Player();
            player.Name = "nakov";
            player.Points = 10;
            target.Add(fileName, player);

            string expected = "1: nakov -> 10" + Environment.NewLine;
            string actual;
            actual = target.Show(fileName);
            Assert.AreEqual(expected, actual);
        }
Пример #3
0
 public Engine(ObjectRenderer renderer, Player player, Playfield playfield, Scoreboard scoreboard)
 {
     this.renderer = renderer;
     this.player = player;
     this.playfield = playfield;
     this.scoreboard = scoreboard;
 }
Пример #4
0
 static void Main()
 {
     ObjectRenderer renderer = new ObjectRenderer();
     Player player = new Player();
     Playfield playfield = new Playfield();
     Scoreboard scoreboard = new Scoreboard();
     Engine engine = new Engine(renderer, player, playfield, scoreboard);
     engine.Run();
     Console.Write("Good Bye!");
     Console.ReadKey();
 }
Пример #5
0
        static void Main(string[] args)
        {
            newGame();
            scores=new Scoreboard();
            String input = "";
            message.move();
            while ((input = Console.ReadLine()) != "exit")
            {
                switch (input)
                {
                    case "top":
                        scores.pokazvane();
                        break;
                    case "restart":
                        newGame();
                        break;
                    case "L":

                        if (!playfield.move(Direction.Left)) message.invalid();
                        else
                        {
                            moves++;
                            playfield.print();
                        }

                        break;
                    case "U":

                        if (!playfield.move(Direction.Up)) message.invalid();
                        else
                        {
                            moves++;
                            playfield.print();
                        }

                        break;
                    case "R":

                        if (!playfield.move(Direction.Right)) message.invalid();
                        else
                        {
                            moves++;
                            playfield.print();
                        }

                        break;
                    case "D":

                        if (!playfield.move(Direction.Down)) message.invalid();
                        else
                        {
                            moves++;
                            playfield.print();
                        }

                        break;
                    default:
                        {
                            message.invalid();
                            break;
                        }

                }
                if (playfield.isWinning())
                {
                    message.win(moves);
                    string name = Console.ReadLine();
                    try
                    {
                        scores.add(name, moves);
                    }
                    finally
                    {

                    };
                    message.nl();
                    newGame();
                }
                message.move();
            }
            Console.Write("Good Bye!");
            Console.ReadKey();
        }
        static void Main(string[] args)
        {
            newGame();
            scores = new Scoreboard();
            String input = "";

            message.move();
            while ((input = Console.ReadLine()) != "exit")
            {
                switch (input)
                {
                case "top":
                    scores.pokazvane();
                    break;

                case "restart":
                    newGame();
                    break;

                case "L":

                    if (!playfield.move(Direction.Left))
                    {
                        message.invalid();
                    }
                    else
                    {
                        moves++;
                        playfield.print();
                    }

                    break;

                case "U":

                    if (!playfield.move(Direction.Up))
                    {
                        message.invalid();
                    }
                    else
                    {
                        moves++;
                        playfield.print();
                    }

                    break;

                case "R":

                    if (!playfield.move(Direction.Right))
                    {
                        message.invalid();
                    }
                    else
                    {
                        moves++;
                        playfield.print();
                    }

                    break;

                case "D":

                    if (!playfield.move(Direction.Down))
                    {
                        message.invalid();
                    }
                    else
                    {
                        moves++;
                        playfield.print();
                    }

                    break;

                default:
                {
                    message.invalid();
                    break;
                }
                }
                if (playfield.isWinning())
                {
                    message.win(moves);
                    string name = Console.ReadLine();
                    try
                    {
                        scores.add(name, moves);
                    }
                    finally
                    {
                    };
                    message.nl();
                    newGame();
                }
                message.move();
            }
            Console.Write("Good Bye!");
            Console.ReadKey();
        }