예제 #1
0
 public Engine()
 {
     labyrinth = new LabyrinthBoard();
     topScores = new TopScores();
     flagContinue = true;
     enterMove = "\nEnter your move (L=left, R=right, U=up, D=down):";
     welcome = "Welcome to “Labirinth” game. Your goal is to escape. \nUse 'top' to view the top scoreboard, \n'restart' to start a new game \nand 'exit' to quit the game.\n";
 }
예제 #2
0
 public Engine(LabyrinthBoard labyrinthBoard, TopScores scores, UserInput userInterface)
 {
     this.Labyrinth = labyrinthBoard;
     this.TopScores = scores;
     this.UserInterface = userInterface;
 }
예제 #3
0
 public void TestConstructorForExceptions()
 {
     testBoard = new LabyrinthBoard();
     // Checking for exceptions.
 }
예제 #4
0
 public void Restart()
 {
     this.flagContinue = true;
     this.labyrinth = new LabyrinthBoard();
     this.labyrinth.InitializeLabyrinth();
     Console.WriteLine("\n" + this.welcome);
     Console.Write(this.labyrinth.ToString());
     this.Move();
 }
예제 #5
0
        private char[,] GetCharArray(LabyrinthBoard board)
        {
            string boardToString = board.ToString();
            string[] rows = boardToString.Split(new string[] {Environment.NewLine}, StringSplitOptions.None);
            char[,] charRepresentation = new char[LabyrinthBoard.LABYRINTH_SIZE,LabyrinthBoard.LABYRINTH_SIZE];

            for(int i = 0; i < LabyrinthBoard.LABYRINTH_SIZE; i++)
            {
                string[] splitRow = rows[i].Split(' ');
                for(int u = 0; u < LabyrinthBoard.LABYRINTH_SIZE; u++)
                {
                    charRepresentation[i,u] = splitRow[u][0];
                    // If all is fine, there should be only one member in this string.
                }
            }

            return charRepresentation;
        }