It's a forest out there
Usage
-
The README contained everything I needed to easily use the program:
-
The program compiles/runs without errors:
Typically we wouldn't want to
#include
cpp files, just header files. Is there a compelling reason to includeadventure.cpp
instead of creating aadventure.h
and including that? -
The program worked as advertised:
Style
-
The code is cleaning divided into modules and multiple files:
A cleaner separation might refactor
adventure.cpp
into a control module and UI module. -
Variable and function names are meaningful:
-
Comments are used where appropriate:
adopting a standard docstring format such as Doxygen would be useful for generating documentation.
Philosophy
-
The program most closely follows the
ed-like
interface pattern:In other examples of menu-driven games I might suggest a command-driven interface instead, but clean separation of the
playerChoice
function eliminates a lot of the clutter that would otherwise be added due to menus in the game loop. -
This choice of pattern is a good one for this application:
-
This program follows the Rule of Silence and Least Surprise:
Initial menus/prompt would have been less surprising if pressing
Enter
or space bar would advance to next screen, instead of requiring to type a letter and then pressEnter
. -
This program follows the Rules of Modularity and Composition:
A little clearer separation between the major components would grant the flexibility of easily customizable user interfaces that could all use the same core game engine. I think the authentication module would be better off as a separate program following a cantrip pattern that is used to control access to the standalone game program. If the game needed user information, this could be supplied with a CLA by a wrapper script.
-
This program follows the Rules of Representation and Simplicity:
While I certainly appreciate the use of the magic number
42
inplayerChoice
, without an check fortotalactions < 42
this is ripe for bugs in the unlikely event you ever need to supply a choice with more than 42 options. Similarly, the code restricts the choices to a-e, why not allow the total number of choices to come from the data file?
Bugs
Pressing ctrl+d
(closing standard input) on username prompt causes an infinite loop.