Coder Social home page Coder Social logo

rock_paper_scissors's Introduction

rock_paper_scissors

rock_paper_scissors app in dart using command line

Project: Rock, Paper & Scissors

Build a command line tool that can play rock, paper and scissors.

When started, the program should show this prompt:

Rock, paper or scissors? (r/p/s)

It should then read the user input and use it as follows:

  • If the user enters "r", "p", or "s", treat this as a valid move.
  • If the user enters "q", quit the program.
  • If the user enters anything else, show "Invalid input", and prompt again.

After the user has entered a valid move, generate another move at random, then compare the two moves according to the rules of the game.

For example, if you played "rock", and the program played "paper", the output should be:

You played: rock
AI played: paper
You lose

The game should repeat until the player quits by pressing

#pseudocode for game logic

  1. while true
  2. show prompt
  3. read user input from console
  4. if input is valid move("r", "p","s")
  5. choose the AI move at random
  6. compare the player move with AI move
  7. show the result
  8. else if input is "q"
  9. Quit the progress
  10. else
  11. invalid input

image image

rock_paper_scissors's People

Contributors

sainideepanshu199 avatar

Watchers

 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.