rock_paper_scissors app in dart using command line
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
- while true
- show prompt
- read user input from console
- if input is valid move("r", "p","s")
- choose the AI move at random
- compare the player move with AI move
- show the result
- else if input is "q"
- Quit the progress
- else
- invalid input