python代写/python编程代写: A text-based “choose your own” adventure game

A text-based “choose your own” adventure game

python代写/python编程代写: 通过python编写一个基于命令行操作的游戏 choose your own,对python和整体程序设计要求较高
Write a text-based “choose your own” adventure game. There will be three ‘rooms’ in the game world, within each room the player will see a number of choices and the program will react to the player’s selection. The game will repeatedly run the game via a main loop (this loop contains most of the instructions of the program) until the game has been won. The goal of this mini-game is to open the locked door to access the rest of the house. The door will only be unlocked if the player turns the key silver lock in the pantry to the ‘right’ position and turns the gold lock in the kitchen to the ‘left’ position. When the door has been unlocked the player can return to the entrance room and open the door to the rest of the house satisfying the goal of this mini-game: the main loop ends and a suitable congratulatory message should be displayed.

Sample program output:

A text file “output_normal_play.txt” shows sample execution of my solution with a normal play through (no erroneous selections). Another text file “output_invalid_selections.txt” illustrates what should happen when the player selects an option that isn’t listed.

Entrance room description

The player begins the game in the entrance. The door that brought the person into the house is gone (it’s a “one-way portal”). When the player is in this room the game will describe the list of possible actions:

1. Try to open the door

2. Go through the left entryway

3. Go through the right entryway

As mentioned the player cannot open the door until it as been unlocked. The player can freely pass through either entryway with no conditions. Entering a non-existent selection will result in a suitable helpful error message (refer to the last section of the ‘repetition’ notes, rules of thumb for how to write good error messages) and the above options are displayed again. The program does not have to handle cases where an invalid type of information (e.g. string instead of number) has been entered. (However, the inability to handle invalid types should then be documented as a “program limitation”). As long as the player remains in the room the program will repeatedly display the above menu options (using a loop) after each time the user enters his/her selection.

Pantry description

As shown in the above map the player can freely pass between the entrance and the pantry. When the player is in the pantry, the game will display the list of possible actions:

1. Turn the silver lock to the left position

2. Turn the silver lock to the right position

3. Turn the silver lock to the center position

4. Don’t change the position! Return to entranceway

Each time the above menu options are displayed the program must show the current position of the lock e.g. “The silver lock is currently set to the right position.”. The starting default is the ‘left’ position. Similar to the entrance if the player enters an invalid selection in the pantry, a suitable and helpful error message should be displayed and the list of options for the pantry will be shown again. As long as the player remains in the room the program will repeatedly display the above menu options and lock status (using a loop) after each time that the user enters his/her selection.

Kitchen description

As shown in the above map the player can freely pass between the entrance and the kitchen. When the player is in the kitchen, the game will display the list of possible actions:

1. Turn the gold lock to the left position

2. Turn the gold lock to the right position

3. Turn the gold lock to the center position

4. Don’t change the position! Return to entranceway

Similar to the pantry, the program should show the current lock position each time the options are presented i.e., “The gold lock is currently set to the center position.”. The starting default is the ‘center’ position. Similar to the entrance if the player enters an invalid selection in the kitchen, a suitable and helpful error message should be displayed and then the list of options for the kitchen (along with the lock position) will be shown again. As long as the player remains in the room the program will repeatedly display the above menu options (using a loop) after each time that the user enters his/her selection.

Part 2:

New Concepts to be applied for the assignment

* Decomposing a problem into functions (includes concepts such as parameters, return values, local variables/scope)

there are six rooms that will mean that your program will consist of at least 7 functions(1 per room plus a starting function). You may be able to subdivide your program using an alternate approach to writing 1 function per room but your program must follow good design principles for using functions.

your solution must set the two locks in a state such that the inner door is unlocked (silver lock = right, gold lock = left)

Once the player passes through the locked door into Part II there is no way to return the original three rooms in Part

发表评论

电子邮件地址不会被公开。 必填项已用*标注