elminson / Rust-Assessment

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rust-Assessment

Task Description:

Develop a Rust program that simulates a simple text-based game of Hangman. The program should allow players to guess letters to reveal a hidden word within a limited number of attempts. The program should accomplish the following tasks:

  1. Select Word: Choose a random word from a predefined list of words .
  2. Display Hidden Word: Show the partially revealed word with underscores for unrevealed letters.
  3. Guess Letter: Allow the player to guess a letter.
  4. Update Display: Update the displayed word to reveal correctly guessed letters.
  5. Track Attempts: Keep track of the remaining attempts and display them to the player.
  6. End Game: End the game when the player either correctly guesses the word or runs out of attempts.

Requirements:

  • Implement the program in Rust.
  • Utilize Rust's standard libraries for user input and randomization.
  • Ensure the list of words is hardcoded within the program to prevent copying from the web.
  • Provide a clear and intuitive command-line interface (CLI) for players to interact with the game.
  • Write clean and well-documented code.
  • Implement error handling for user input and game logic.
  • Avoid using external crates/libraries for core functionality.

Example Usage:

Evaluation Criteria:

Candidates will be evaluated based on:

  • Correctness and completeness of game logic.
  • Clarity and readability of the code.
  • Proper error handling for user input and game logic.
  • Efficiency of random word selection and display updating.
  • Adherence to Rust best practices and idioms.

About


Languages

Language:Rust 100.0%