Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. (4 pts) Back in the days before fancy graphics became the norm, people played computer games that were entirely text-based. A famous example is
1. (4 pts) Back in the days before fancy graphics became the norm, people played computer games that were entirely text-based. A famous example is Zork, written by four students at the Massachusetts Institute of Technology in the late 1970s. If you're curious to see what gaming was like back then, you can play a version of Zork online here: https:/classicrcload .com/zork-i.html Let's say that you want to write your own text-based adventure game. Before your hero(ine) can set out to engage in epic battle, sthe needs to be able to move around! Assume that your character moves on a flat surface and can move one unit at a time in any of the four cardinal directions (north, south, east, or west). You start the game at position (0, 0). Within a new class named TextGame, write a program that allows the player to issue movement commands to his her character, one at a time. After each command, display the character's new position. Also allow the player an option to exit the program, and include some error checking to catch Hint: Use two variables to keep track of the player's current position (one for the x-coordinate, one for the y-coordinate). Use a multibranch conditional to change these variables' values depending on what direction the player travels. Below is an example of what your program might look like while running. The underlined parts indicate what you type in as the program is running Welcome to World of TextCraft! You are eurrently at (0, 0) Enter command (1 North, 2 East, 3 South, 4West, 5 Exit): 1 Moving north You are currently at (0, 1) Enter command (1-North, 2 = East, 3 = South, 4-West, 5 = Exit): 1
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started