RoboText

due: Monday 1/31

Game Play

For this assignment you will create a text based version of the game robots. Before starting, take some time to play one variant of the game which you can find in the Games menu of the department Linux machines.

In this game, the player's character is placed on a grid with some number of robots. Each turn the player can do one of the following: stay put, move to one of the eight adjacent spaces, or teleport to a random spot on the board.

After the player moves each robot takes a turn moving one space closer to the player. If the robot hits the player (or the player hits a robot), the game is over. If a robot hits another robot, both are destroyed and replaced with a pile of rubble. If a robot hits a pile of rubble, the robot is destroyed and the rubble remains.

In the sample output below, the player is represented by a 'P'. The 'O's are robots and the 'X's are rubble. I used '.' for empty space so I could see where everything is better.

In these turns, a player types a move, hits enter and the board is redrawn after all of the robots have had their turn to move.

________________________________________
........................................
........................................
........................................
........................................
........................................
........................................
........................................
...............OX.O....O....X.....O..P..
.............X..........................
........................................
........................................
........................................
........................................
........................................
........................................
........................................
........................................
........................................
........................................
........................................
________________________________________
       7 8 9     Stay: 5
Move:  4   6     Teleport: 0
       1 2 3     Quit: q
6

________________________________________
........................................
........................................
........................................
........................................
........................................
........................................
........................................
................X..O....O...X......O..P.
.............X..........................
........................................
........................................
........................................
........................................
........................................
........................................
........................................
........................................
........................................
........................................
........................................
________________________________________
       7 8 9     Stay: 5
Move:  4   6     Teleport: 0
       1 2 3     Quit: q

Other rules are entirely up to you.

Implementation Notes


Grading rubric

This program will be worth 100 points.

Topic Points Description
Code Format 5

Use good indenting. Don't have more than 80 characters on a single line. Use consistent capitalization. Generally, variables and function names are lower case. User defined types (such as classes) start with a capital letter. Constants are all capital letters.

Code Documentation 5

Although comments are important in making your code readable, you also want to make sure you use good, descriptive variable and function names. Certain variables, like the automatic variable "i" in a for loop can have short, commonly used names. Functions and method names should usually be verb phrases e.g. getTimeOfDay() and isGameOver().

You should also avoid magic "numbers" whenever reasonable to do so, use constants instead. The use of 0 or 1 is usually okay, but values such as 6, 3562 or '?' probably have some interesting meaning in your program and a (const) variable name is a great way to describe it.

Code Organization 10

There is no reason to have a 100 line long main function. Break long portions of code into related chunks and put those chunks in functions or methods. The code at the top level will be much easier to read, and the entire program will be easier to maintain. Encapsulate data and related methods into classes.

Game Specifications 60

The game runs more or less as described. You may make modifications in the specifications in order to satisfy the functionality and creativity portion of the assignments.

Functionality 15

You MUST include some additional feature(s) in your game. For example: some robots move more than one space per turn or once a player wins a level they start a more difficult level. You can get some other ideas from playing the Linux game or make up your own.

Creativity 5

Incorporate your own style into the features or the display of the game. I would give you suggestions, but that would be missing the point.


Submission

You will need to submit the following files via the assignment page in Moodle.
  1. Any .cpp or .h files you (or eclipse) created for the project.
  2. A README file containing: