Difference between revisions of "Python - Descriptions module assignment"
From WLCS
(Created page with "== Objective == * You will learn to create a module comprised of list variables and functions == Purpose == * The Descriptions module will allow us to generate a random adjectiv...") |
(→Directions) |
||
Line 6: | Line 6: | ||
== Directions == | == Directions == | ||
− | # Download [[ | + | # Download [[descriptions.py]] |
− | # Examine the code in [[ | + | # Examine the code in [[descriptions.py]] |
#* There are four lists: room adjectives, room types, monster names, weapon names | #* There are four lists: room adjectives, room types, monster names, weapon names | ||
# Add 5 more values to each of the lists | # Add 5 more values to each of the lists |
Revision as of 14:09, 9 May 2013
Contents
Objective
- You will learn to create a module comprised of list variables and functions
Purpose
- The Descriptions module will allow us to generate a random adjective to describe a room ("dark", "haunted", etc.) and a random room type ("living room", "parlor", etc.), as well as random weapon names ("katana", "sai", etc.) and monster names ("goblin", "troll", etc.).
Directions
- Download descriptions.py
- Examine the code in descriptions.py
- There are four lists: room adjectives, room types, monster names, weapon names
- Add 5 more values to each of the lists
- Define the following functions:
- string getNextRoomAdjective() - returns a random adjective from the roomAdjectives list
- string getNextRoomType() - returns a random adjective from the roomTypes list
- string getNextMonsterName() - returns a random adjective from the monsterNames list
- string getNextWeaponName() - returns a random adjective from the weaponNames list
Testing
- Execute DescriptionGenerator.py to see how we generate random descriptions