private Dictionary<string, Response> responses; //responses to commands #endregion Fields #region Constructors /// Initialize the command response mapping /// game The game being played. public CommandMapper(Game game) { responses = new Dictionary<string, Response>(); Response[] resp = { new Quitter(), new Goer(game), new Helper(responses, this) // add new Responses here! }; AllCommands = ""; foreach (Response r in resp) { responses[r.CommandName] = r; AllCommands += r.CommandName + " "; } }
/// Constructor for objects of class Goer public Goer(Game game) { this.game = game; CommandName = "go"; }
/// Constructor for objects of class Goer public Goer(Game game) { this.game = game; }
public static void Main(string[] args) { Game game = new Game(); game.play(); }