Comp 101 Lab5: A basic text game
Due . Tuesday April 1 at Midnight. (it seems like a
long time, but factoring in the fact that you will be out for break,
its really not)
Introduction:
In this lab you will develop a simple "text
game." Text games were popular before computers had the capacity to do
significant graphical work. Today they are being revived under
the name "interactive fiction".
Objectives:
- Continue to write your own programs from scratch, this time in a large program.
- work with loops
- Work with selection
Assignment Specifications:
Write a program that will tell an interactive fiction story.
Further
lets begin doing so program design. Make sure your program is broken
down into several methods. You can use a single class. Below are the
methods you should implement and a discription of what those methods
should do. None of these methods are allowed to be static methods.
- getInput should return the user input. This is the only method allowed to use a Scanner or JOptionPane object.
- printOutput should be the only method that prints to the screen.
- StoryLoop: this method will do the majority of the work in the program.
Make Story loop
- You should loop through a getinput-check-printOutput loop
untill
the story ends. (you can use an infinite loop and then when an ending
state is
reached, use a break to leave the loop. Or just check a 'done' flag
[implemented as an instance variable] which starts out as false and
then is set to true when the story is done. )
- You should have at least one path through the story that will result in you having at least 6 interactions with the user
- the other paths through the story should have at least 3 interactions.
- There should be at least 2 choices at each interaction with the user.
- When the story is over, exit the program.
- Use
the player's character name at least once in the story. (so before you
begin you should ask the player what his/her name is and record that
somewhere - perhaps an instance variable)
You are welcome to add any additional support methods that you
need to this rather minimal list of methods. Of course you will need a
constructor for your class to initialize the instance variables and a
main method to start things off as well.
Submitting
When you submit this time, add a readme.txt file to your lab5 folder
that you are building. This time you are buiding an insteresting program which may be different from everyone elses so the
readme should contain:
- Your name.
- A very brief summary of what you did, including any new methods you added and why you chose to implement things the way you did.
- A quick summary of your game/story and what I should expect it to say.
- Directions
on how to run your program and anything unusual that I need to do to
get it working properly. (do I type in numbers or text at the prompt
when you are prompting me to enter some input?
- A list of any problems still in your code or anything that you didn't get done.
Once you have the readme done, cd into your parent folder, zip up the
entire lab4 folder using the -r flag as you have learned in the last
few labs, and use the online submission program to submit it to me. Remember to include your last name in the title of your zip file.