+def command_makeworld():
+ """Mere dummy so far."""
+ print("I would build a whole world now if only I knew how.")
+
+
+def command_ping():
+ """Send PONG line to server output file."""
+ io_db["file_out"].write("PONG\n")
+ io_db["file_out"].flush()
+
+
+def command_quit():
+ """Abort server process."""
+ raise SystemExit("received QUIT command")
+
+
+"""Commands database.
+
+Map command start tokens to ([0]) minimum number of expected command arguments,
+([1]) the command's meta-ness (i.e. is it to be written to the record file, is
+it to be ignored in replay mode if read from server input file), and ([2]) a
+function to be called on it.
+"""
+commands_db = {
+ "QUIT": (0, True, command_quit),
+ "PING": (0, True, command_ping),
+ "MAKE_WORLD": (1, False, command_makeworld)
+}
+