Chapter: Command-line games
1. Introduction to command-line games¶
This chapter documents the programming interface for the CTGames framework with respect to command-line games.
See also
Chapter “Game development” provides general guidelines for the development of CTGames games.
Chapter “Template game explained” explains how to get started programming a command-line CTGames game.
Chapter “Web app games” provides guidelines for how to turn a CTGames command-line game into a web app.
The files that need to be modified to make a command-line game are
logic.pyis where the game logic and all the data structures specific to your game are defined,
behaviour.pyis where the number of rounds in the game is defined and how the difficulty and game mechanics change from round to round,
text_constants.pyis where all of the static human-readable strings in the game are defined (e.g. question, instructions), and
cl.pyis where the type and allowed values for the parameters that control game difficulty and game mechanics are defined, as well as any dynamic formatting of the human-readable strings in the game.
1.1. Overview of the chapter¶
General guidelines
The section “Guidelines for command-line game development” gives general guidelines for developing command-line CTGames games.
Specific functions
The section “The function create_game_round()” explains the details of modifying the function
create_game_round().The section “The function process_input_and_solve_task()” explains the details of modifying the function
process_input_and_solve_task().
Advanced functionality
Section “Advanced functionality supported in logic.py” describes advanced functionality available through the
logic.pyfile for each game that you may need as your game becomes more sophisticated.Similarly, section “Advanced functionality supported in cl.py” describes advanced functionality available through the
cl.pyfile.
Checklist for game completion
Section “Checklist for command-line game completion” reminds you of all of the tasks that must be completed in order to finish developing a command-line game.