Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create and code inJavaa simple text-based adventure game to make the character move in between rooms. The adventure game you will implement for this assignmentlike

Create and code inJavaa simple text-based adventure game to make the character move in between rooms.

The adventure game you will implement for this assignmentlike any of the text-based adventure games that were demonstrated by your classmates in class earlier this semestertakes place in a virtual world in which you, as the player, move about from one location to another. The locations, which are traditionally called rooms even though they may be outside, are described to you through a written textual description that gives you a sense of the geography. You move about in the game by giving commands, most of which are simply an indication of the direction of motion. For example, you might move about as follows:

The adventure program you will create for this assignment and all followed up assignments is entirely data driven. Just like your final project. The program itself doesnt know the details of the game geography, the objects that are distributed among the various rooms, or even the words used to move from place to place. All such information is supplied in the form of data files, which the program uses to control its own operation. The ultimate goal is if you run the program with different data files, the same program will guide its players through different adventure games.

For this first assignment, there must be an associated data file:

  • Rooms.txt, which defines the rooms and the connections between them.
  • You can also have two text files, one to define rooms and one to define connections.
  • The number of the text file and the structure of the text files are entirely up to you as long as you accomplish the task.

For example, the room data file could have the following information:

  • A room number, which must be greater than zero
  • Its name, which is a one-line string identifying the room
  • Its description, which is a multiline array describing the room
  • A flag indicating whether the room has been visited
  • A navigation table specifying the exits and where they lead

For example, this data file is not a Java program, but is instead text file that describe the rooms and their connections.

The program you will write for this assignment must:

  1. Read this file into an internal data structure, which it then displayed to the user on the console to guide the player through the game.
  2. Allow the player to be able to move between rooms by reading and executing navigation commands entered by the user through the console
  3. Your program should be able to track visited rooms and display the message visited on the console if the player revisit a room.
  4. A total of 6 rooms is required for this assignment with the following navigation command:
    1. North
    2. East
    3. South
    4. West

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

App Inventor

Authors: David Wolber, Hal Abelson

1st Edition

1449397484, 9781449397487

More Books

Students also viewed these Programming questions

Question

What approach(es) to psychotherapy do you prefer?

Answered: 1 week ago