3.05 Hand in: Character Generator

Computer Programmer - the RPG

Let's say that I have created a role-playing game in which people play computer programmers with different skills and abilities. I know! Brilliant idea! I am going to make a mint!

Let's say that each character could have the following characteristics:

Name Dragos the Security Guru
Typing 5 Random die roll from 1-6
Spelling and Grammar 3 Random die roll from 1-6
Modularizes Code 6 Random die roll from 1-6
Problem Solving 2 Random die roll from 1-6
Awesome with CSS 2 Random die roll from 1-6
Coding Style 6 Random die roll from 1-6

An example

When I put all of this together, I can get this:

Please enter a name for your character:

Your character:

Saving your work

Download the template and rename it: "3.05H-CharacterGenerator-LastName.html".

The assignment

Use objects and functional programmming to ask the user for a character name, generate random characteristics, generate a simple character sheet, and then output the sheet.

Use whatever game system you want. Or create your own. Or make something that is a kind-hearted parody. Have fun with this.

Recommended procedure

  1. Read over Qualities of a Programmer again
  2. Plan your user interface first
  3. Plan your variables next paying special attention to your object variable
  4. Plan your separate functions input, process, and output functions. You should have a separate function for generating the character statistics and the character sheet.
  5. Decide on how the functions will work together in a function pipeline
  6. Create your functions empty at first with only the input parameters and return variables, like this:

    function someKindOfFunction (inputVariable) {
          console.log('in someKindOfFunction, inputVariable=' + inputVariable);
          var outputVariable;

          return outputVariable;
    }
  7. Fill in the actual working code of the functions last of all, testing as you go.

Evaluation