Giter Site home page Giter Site logo

roshambo's Introduction

Exercise 09: More practice!
=======

Introduction
-------
Practice needs no introduction!

Description
-------
Here are some fairly standard programs every programmer must write in the process of learning. 
You've already written the guessing game and the temperature converter. Try to do the others:

http://mypythonquiz.com/list.php
http://people.csail.mit.edu/pgbovine/python/question.html?remove-dups#mode=edit
http://people.csail.mit.edu/pgbovine/python/question.html?two-sum#mode=edit
http://www.openbookproject.net/pybiblio/practice/wilson/

All of them are doable with your current skillset, but some will require more complex composition of everything you know. Try to get as far as you can!






Rock, Paper, Scissors

Description

Rock, paper, scissors, also know as roshambo, is a simple child's game that is frequently used to settle disputes. In the game, a rock breaks the scissors, the scissors cut the paper, and the paper covers the rock. Each option is equally likely to prevail over another. If the players choose the same object a draw is declared and the game is repeated until someone prevails. For more information than you ever thought it was possible to collect about rock, paper, scissors, check out the Web page of the World RPS Society.

In this computerized version the human player competes against the computer which chooses a rock, paper, or scissors randomly. The game proceeds until the human player quits the game or until a predetermined score is reached (e.g., 11 pts.) at which time the final tally is displayed. Solutions with fewer numbers of if statements are considered more elegant.

Input

The human player enters the number of points required for a win. During the play of the game the human player selects whether to play a rock, paper, or scissors by using the keyboard. The human player may also end the game by pressing the Control-D sequence at any time. (Ending the game early does not allow a winner to be determined if the human player is ahead.)

Output

The program will display the winner of each roshambo round along with the running score. At the conclusion of the game, the computer will display the overall winner and the final score.

Sample session

Welcome to Rock, Paper, Scissors!

How many points are required for a win? 3

Choose (R)ock, (P)aper, or (S)cissors? r
Human: rock    Computer: paper        Computer wins!

Score: Human 0   Computer 1
Choose (R)ock, (P)aper, or (S)cissors? r

Human: rock    Computer: scissors     Human wins!

Score: Human 1   Computer 1
Choose (R)ock, (P)aper, or (S)cissors? p

Human: paper   Computer: paper        A draw

Score: Human 1   Computer 1
Choose (R)ock, (P)aper, or (S)cissors? s

Human: scissors  Computer: paper      Human wins!

Score: Human 2   Computer 1
Choose (R)ock, (P)aper, or (S)cissors? r

Human: rock      Computer: scissors   Human wins!

Final Score: Human 3   Computer 1
Going further

Ask the user for his or her name and use the name while the game is playing.
Display randomly chosen taunts when the computer wins.
Consult the World RPS Society Web page and try to program the computer to use some strategy.

roshambo's People

Contributors

michellesun avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.