CS 313E: Bulko

Programming Assignment 2:
Role-Playing Games
Due Date: September 22, 11:59 pm

A role-playing game or RPG is a game in which players assume the roles of characters in a fictional setting. The popularity of the epic saga told in J.R.R. Tolkien's The Hobbit and The Lord of The Rings greatly influenced the genre, as seen in the game Dungeons & Dragons and all of its subsequent variants.

In most RPGs, a player creates a character of a specific archetype or class, such as "Fighter", "Wizard", or "Thief". (Note: do not confuse a "character class" with a Python class; although we will define character classes using Python classes, they do not mean the same thing, so it might be a little confusing.) The class defines a set of characteristics, constraints, and behavior that apply to all characters of that class. For example, a Thief has the ability to move with great stealth; however, in order to do that effectively, the Thief cannot wear bulky, noisy armor or carry large weapons.

In this assignment, you will create a very simple RPG. You will define two character classes, define characteristics and actions associated with those classes, and create one character of each class. You will define types of weapons and armor suitable for your characters to use. Finally, you will have your two characters battle each other!


Define a Python class called Weapon. When a Weapon object is created, it should include as a parameter a String that identifies the weapon type. Each weapon type will do a specific amount of damage when it strikes an opponent.

Valid weapon types and the damage done by each are:


Define a Python class called Armor. When an Armor object is created, it should include as a parameter a String that identifies the armor type. Each armor type offers a specific amount of protection (the "Armor Class" or AC) when an opponent attacks the character wearing the armor.

Valid armor types and the AC associated with each are:


Define a Python class called RPGCharacter.

Define a subclass of RPGCharacter called Fighter. Fighters possess the following characteristics:

Define a subclass of RPGCharacter called Wizard. Wizards possess the following characteristics:

When a character is created, it should include as a parameter a String that identifies the character's name. Creation of a character should also initialize the following characteristics:


A character of any class can perform the following actions:

A wizard (and only a wizard) can also perform the following action:

Two other methods you must define are:

Main Program:

Test your program thoroughly with your own characters and sequence of actions. However, to make it easier to grade your assignment, turn in your code using the following main program:

For debugging purposes, here is the expected output that this main program should produce:

Disclaimer for serious RPG gamers: this RPG has been stripped down for the purpose of keeping the homework assignment simple. Consequently, several standard features common to RPGs have been omitted; for example:

However, this doesn't prevent you from adding these features yourself if you want to create your own fun RPG! Sorry, no extra credit for doing this, though. :-)

Turning in the Assignment:

The program that you will write should appear in a file called RPG.py. There is no input data file for this assignment. Submit the file via Canvas before the deadline shown at the top of this assignment.