首页 > > 详细

辅导 COMP10065 Secure Programming Second Assignment讲解 R语言

Second Assignment

Secure Programming

COMP10065

Issue Date: Monday, March 11th, 2024

Due Date: 5pm, Friday, April 12th, 2024

Hangman

Hangman is a paper and pencil guessing game for two or more players.  One player thinks of a word, phrase or sentence and the other(s) tries to guess it by suggesting letters within a certain number of guesses.

In this assignment, you should implement Hangman in Rust.

A computer version of Hangman will use the computer as the second player. The human participant will then input a sequence of letter guesses. A simple version need not depict the Hangman figure, and need only report how many guesses remain after each attempt; and a final message of successor failure. The entire word can also be guessed.  In this case, an incorrect guess has the same effect as an incorrect letter guess. Rust macros such as println! are sufficient to handle the visual aspect of the program.

You can assume that each guess is an upper or lower case letter from the alphabet: a space within a fruit name does not need to be guessed.

Include short code excerpts or pseudocode in your report. If you  didn’t achieve some of the tasks, include a section reflecting on these tasks.

You should work individually. Submit  the  code  you  develop, along with a short pdf report of approximately 500 words;  as a single zip to Aula by the date noted above. Do not submit any intermediate files, or the final executable. (Run cargo  clean before submitting.)

Marking Scheme

The assignment is worth 40% of the marks awarded for the entire COMP10068 module. The following provides a breakdown of the marking scheme:

CO

Ensure your program runs using cargo  run

1%

HW

Display the hidden word, with underscores in place of each letter For example, if the word was Apple”:

2%

RA

Display the number of remaining attempts

2%

SQ

Handle a sequence of guesses from the user (e.g.  via a loop)

2%

UW

Update the hidden word, with each correct guess

For example, guessing “p” in Apple gives: p p

2%

UN

Update the number of remaining attempts, with each incorrect guess

2%

FM

Display a failure message if the player runs out of tries

2%

SU

Display a message of success if the player guesses all the letters

2%

EW

Handle the user attempting the entire word, as well as a single letter

3%

PA

After the game, allow the player to choose to play again

3%

FR

Use your program to open the fruits.txt file and read the contents

2%

FW

Choose the hidden word from this list of fruit names

2%

RN

Ensure the word chosen from the fruit list is chosen randomly

2%

SP

As a courtesy, initialise spaces in fruit names which have them For example, if the word is “Star fruit”, display:

4%

NR

Avoid bias in the random fruit selection by removing repeated fruit names from your program’s data structure (do not edit fruits.txt)

4%

RE

A 500 word report on your approach to the problem

5%

Resources

You are provided with a sample folder containing a Rust program and associated Cargo files; compatible with Visual Studio Code. Currently, the program only displays a greeting. Change this to operate as the Hangman game described. Note that you may need to edit the Cargo.toml file when using some external libraries; for example, for random number generation.





联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!