Compile and Run Our Game

Let’s compile our enhanced version of the project and try out the gameplay.

  1. First, build the project:

    $ cmake --build cmake-build
    ...
    
  2. Make sure to fix any errors we previously introduced in the configuration file.

    configuration.elcl
    1[field]
    2width: 30
    3height: 16
    
  3. Now launch the game:

    $ ./cmake-build/robot-escape/robot-escape configuration.elcl
    

The Gameplay

When the game starts, you’ll see a short welcome message followed by the rendered game field. A prompt invites you to enter your next move.

----------------------------==[ ROBOT ESCAPE ]==-----------------------------
Welcome to Robot Escape!
You (☻) must run to the exit (⚑) before any robot (♟) catches you.

░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░░░░┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓░░░░
░░░░┃                              ┃░░░░
░░░░┃                              ┃░░░░
░░░░┃       ♟                      ┃░░░░
░░░░┃                              ┃░░░░
░░░░┃                              ┃░░░░
░░░░┃                 ☻     ♟      ┃░░░░
░░░░┃        ⚑                     ┃░░░░
░░░░┃                              ┃░░░░
░░░░┃                              ┃░░░░
░░░░┃            ♟                 ┃░░░░
░░░░┃                              ┃░░░░
░░░░┃                              ┃░░░░
░░░░┃                              ┃░░░░
░░░░┃                              ┃░░░░
░░░░┃                              ┃░░░░
░░░░┃                              ┃░░░░
░░░░┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

Enter your move (n/e/s/w/q=quit): s

Each move updates the world: the player and robots move one step, and their paths are visualized using trails. Here’s how the game looks after a few steps:

░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░░░░┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓░░░░
░░░░┃                              ┃░░░░
░░░░┃                              ┃░░░░
░░░░┃       ∙                      ┃░░░░
░░░░┃       ∙                      ┃░░░░
░░░░┃       ∙♟                     ┃░░░░
░░░░┃                 ∙  ♟∙∙∙      ┃░░░░
░░░░┃        ⚑      ☻∙∙            ┃░░░░
░░░░┃             ♟                ┃░░░░
░░░░┃             ∙                ┃░░░░
░░░░┃            ∙∙                ┃░░░░
░░░░┃                              ┃░░░░
░░░░┃                              ┃░░░░
░░░░┃                              ┃░░░░
░░░░┃                              ┃░░░░
░░░░┃                              ┃░░░░
░░░░┃                              ┃░░░░
░░░░┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

Enter your move (n/e/s/w/q=quit): w

This is getting intense! The robots are just one step behind…

░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░░░░┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓░░░░
░░░░┃                              ┃░░░░
░░░░┃                              ┃░░░░
░░░░┃                              ┃░░░░
░░░░┃          ☻♟∙ ♟∙              ┃░░░░
░░░░┃          ♟∙∙  ∙              ┃░░░░
░░░░┃          ∙∙∙  ∙              ┃░░░░
░░░░┃        ⚑                     ┃░░░░
░░░░┃                              ┃░░░░
░░░░┃                              ┃░░░░
░░░░┃                              ┃░░░░
░░░░┃                              ┃░░░░
░░░░┃                              ┃░░░░
░░░░┃                              ┃░░░░
░░░░┃                              ┃░░░░
░░░░┃                              ┃░░░░
░░░░┃                              ┃░░░░
░░░░┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

Enter your move (n/e/s/w/q=quit): w

And finally—you reach the goal unharmed!

░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░░░░┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓░░░░
░░░░┃                              ┃░░░░
░░░░┃                              ┃░░░░
░░░░┃                              ┃░░░░
░░░░┃        ∙∙∙∙∙                 ┃░░░░
░░░░┃        ∙∙♟                   ┃░░░░
░░░░┃        ♟∙∙                   ┃░░░░
░░░░┃        ☻♟                    ┃░░░░
░░░░┃                              ┃░░░░
░░░░┃                              ┃░░░░
░░░░┃                              ┃░░░░
░░░░┃                              ┃░░░░
░░░░┃                              ┃░░░░
░░░░┃                              ┃░░░░
░░░░┃                              ┃░░░░
░░░░┃                              ┃░░░░
░░░░┃                              ┃░░░░
░░░░┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

You won!

Recap

Your game is up and running—and it already feels fun and challenging! Give it a few more rounds, explore different strategies, and start thinking about how you might expand or improve the gameplay.

Make the Field Configurable →