forked from University/epr24pr42-ojanssen2
53 lines
1.2 KiB
C++
53 lines
1.2 KiB
C++
#include "Environment/Maze.h"
|
|
#include "Game.h"
|
|
#include "MalformedMaze.h"
|
|
#include "GameState.h"
|
|
|
|
using game::Maze;
|
|
using game::Game;
|
|
using game::GameState;
|
|
|
|
using game_exceptions::MalformedMaze;
|
|
|
|
// Ein Programm, welches dir erlaubt ein Labyrinth zu erkunden mit 'w', 'a', 's', und 'd'.
|
|
|
|
void print_exit_message_based_on_state(const GameState& state);
|
|
|
|
int main()
|
|
{
|
|
GameState state = GameState::RUNNING;
|
|
try
|
|
{
|
|
Maze maze = Maze::request_maze_from_user();
|
|
|
|
Game game = Game(maze);
|
|
|
|
game.run_game();
|
|
|
|
state = game.get_state();
|
|
}
|
|
catch (MalformedMaze& _)
|
|
{
|
|
cout << "Fehler beim Einlesen des Labyrinths.\n";
|
|
return 0;
|
|
}
|
|
|
|
print_exit_message_based_on_state(state);
|
|
|
|
return 0;
|
|
}
|
|
|
|
|
|
/// Schriebe eine Nachricht in die Konsole wenn das Programm beendet wird
|
|
/// @param state Der Spielzustand als das Programm beendet wurde
|
|
void print_exit_message_based_on_state(const GameState& state) {
|
|
switch (state){
|
|
case GameState::QUITTING:
|
|
cout << "Schoenen Tag noch!" << "\n";
|
|
break;
|
|
case GameState::HIT_BY_GHOST:
|
|
cout << "Sie haben einen Geist getroffen! Game Over!\n";
|
|
default:
|
|
break;
|
|
}
|
|
}
|