Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jonocarroll/rps.rs

Rock, Paper, Scissors game, demonstrating enums
https://github.com/jonocarroll/rps.rs

Last synced: 8 days ago
JSON representation

Rock, Paper, Scissors game, demonstrating enums

Awesome Lists containing this project

README

        

# rps

Play rock ๐Ÿชจ, paper ๐Ÿงป, scissors โœ‚๏ธ against the computer

Demonstrates uses of `enum`

## Examples
```rust
cargo run -q
Let's play! ๐Ÿชจ๐Ÿงปโœ‚๏ธ
What do you throw?
rock
You threw... Rock ๐Ÿชจ
Computer throws Rock ๐Ÿชจ
Result: It's a tie! ๐Ÿ‘”
Press ENTER to play again, or anything else to quit

Let's play! ๐Ÿชจ๐Ÿงปโœ‚๏ธ
What do you throw?
paper
You threw... Paper ๐Ÿงป
Computer throws Scissors โœ‚๏ธ
Result: Sorry, you lose ๐Ÿ˜ฟ
Press ENTER to play again, or anything else to quit

Let's play! ๐Ÿชจ๐Ÿงปโœ‚๏ธ
What do you throw?
scissors
You threw... Scissors โœ‚๏ธ
Computer throws Paper ๐Ÿงป
Result: You win, congrats! ๐ŸŽ‰
Press ENTER to play again, or anything else to quit
```

A single argument can also be passed to play just once

```rust
cargo run -q -- rock
Let's play ๐Ÿชจ๐Ÿงปโœ‚๏ธ!
You threw... Rock ๐Ÿชจ
Computer throws Rock ๐Ÿชจ
Result: It's a tie! ๐Ÿ‘”
```