User Tools

Site Tools


user:dgirard3:portfotlio:project3

Project: RoShamBo

A project for C/C++ programming by Derek Girardi during the fall 2011.

This project was begun on11/15/11 and is completed on 3days?

Objectives

Make a game of Rock, Paper, scissors and shoot!

Prerequisites

In order to successfully accomplish/perform this project, the listed resources/experiences need to be consulted/achieved:

  • Ability to log onto lab46
  • Ability to use nano/VI or a text editor of some sort
  • Ability to compile C code
  • Ability to execute
  • Ability to use loops

Background

The multiplication table is a simple program that can be written by anyone starting out in C. It has simple techniques that anyone can learn. However this can be done in more advanced ways like multi-dimensional arrays or class types and such. There is not much to really say other then that this is a multiplication table and i am pretty sure everyone knows what it is.

Scope

In this project your task is to implement a playable “Rock, Paper, Scissors” program to play against the computer.

Rules

Our game will be designed for two players.

You will be one player

The computer will be the other player

There are three objects which can be played: a rock, a piece of paper, and a pair of scissors.

The rock will break the scissors (rock beats scissors)

The paper will cover the rock (paper beats rock)

The scissors will cut the paper (scissors beats paper)

Gameplay will consist of three rounds

whoever has triumphed the majority of the time will win

Programming Considerations

You can design your program so that a certain player always goes first, or have that be picked randomly.

Computer's choice will be pseudo-random, using the C random number generator.

your program should display a welcome message and offer to print instructions.

This means you will need to accept input from the user on STDIN and properly evaluate it.

Throughout the program, check for invalid input.

Output a message and keep looping until the correct value is entered.

Upon the user's turn:

  1. your program should prompt you for the item you wish to pick
  2. You are free to come up with any sort of input scheme (1 for rock, 2 for paper, etc.).

Upon the computer's turn:

  1. you need to print out a message indicating what piece the computer has “chosen”.

At the end of each round:

  1. display who won the round
  2. explain how the round was won

a score needs to be kept, so at the end of the third round, you can display the winner.

When the game is over, ask the user if they wish to play again.

If yes, the game will be played again (3 rounds)

If no, the program should exit

Attributes

State and justify the attributes you'd like to receive upon successful approval and completion of this project.

  • Variables
  • I/O
  • Repetition
  • selection

Procedure

Code

 

Execution



Reflection

This project was not too hard, just ran into an infinite loop but in the end i got it.

References

In performing this project, the following resources were referenced:

user/dgirard3/portfotlio/project3.txt · Last modified: 2011/11/21 13:32 by dgirard3