Coder Social home page Coder Social logo

tlow22 / guessing-game Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 6 KB

An tutorial implementation of the guessing game as described on the Rust website - https://doc.rust-lang.org/book/ch02-00-guessing-game-tutorial.html

License: MIT License

Rust 100.00%

guessing-game's Introduction

guessing-game

An implementation of the guessing game tutorial as described on the Rust website - https://doc.rust-lang.org/book/ch02-00-guessing-game-tutorial.html. To test it, clone the repo and enter cargo run in the terminal:

The game is summarized as a lottery game, where a randomly selected winning number exists between 1-100 (integer)

The user is repeatedly prompted to select a number (integer) between 1-100:

Winning number = 83

Guess a number between 1-100. 3 out of 3 tries remaining.
  • if the winning number is selected, winning message is displayed
Winning number = 49

Guess a number between 1-100. 3 out of 3 tries remaining.
49
You guessed: 49
Winning number = 49
You win!
  • if the winning number is not selected, re-prompt
Guess a number between 1-100. 3 out of 3 tries remaining.
1
You guessed: 1
Too small!

Guess a number between 1-100. 2 out of 3 tries remaining.
2
You guessed: 2
Too small!

until maximum number of tries is exhausted, then inform of loss

Guess a number between 1-100. 1 out of 3 tries remaining.
3
You guessed: 3
Too small!
You get nothing! You lose! Good day sir!

Bonus Feature(s)

  • Maximum 3 tries allowed
  • Exclude invalid entries (out of range, non-numbers, etc.) from being counted as attempts

guessing-game's People

Contributors

tlow22 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.