public void InitGame() { //var game = Control.Instance; //this.visualization.PrintStartMessage(); //var labyrinth = game.Setup.SetupNewLabyrinth(); //game.State.IsInitialized = true; IObjectFactory instanceFactory = new ObjectFactory(); Labyrinth labyrinth = new Labyrinth(LabyrinthSize, LabyrinthSize, instanceFactory); GameObjectsGenerator generator = new GameObjectsGenerator(); generator.GenerateObjectsNew(labyrinth); this.visualization.PrintMessage("Labyrinth is Ready"); this.visualization.DrawLabyrinth(labyrinth); MovesFactory movesFactory = new MovesFactory(labyrinth); while (!labyrinth.State.IsFinished) { IMoves move = this.visualization.GetUserCommand(movesFactory); move.Move(); this.visualization.DrawLabyrinth(labyrinth); } }
public bool MoveChecker(Position position) { Labyrinth Labyrinth = this.Labyrinth; if (position.Column >= Labyrinth.Columns || position.Column < 0 || position.Row >= Labyrinth.Rows || position.Row < 0) { return(false); } else if (Labyrinth[position] is FreeSpace) { return(true); } else { return(false); } }
public void DrawLabyrinth(Labyrinth labyrinth) { for (int i = 0; i < labyrinth.Rows; i++) { for (int j = 0; j < labyrinth.Columns; j++) { var currentGameObject = labyrinth[i, j]; char currentSymbol = currentGameObject.Visualization; //Console.BackgroundColor = currentGameObject.BackgroundColor; //Console.ForegroundColor = currentGameObject.ForegroundColor; Console.Write(currentSymbol + " "); } Console.WriteLine(); } Console.ResetColor(); }
public LabyrinthNavigation(Labyrinth labyrinth, Position position) { this.Labyrinth = labyrinth; this.CurrentPosition = position; }
public LabyrinthNavigation(Labyrinth labyrinth) { this.Labyrinth = labyrinth; this.CurrentPosition = labyrinth.StartPosition; }