top of page
Writer's pictureCodersarts AI

Criss-Cross Multi-Step Word Guessing Game Assignment


Questionnaire


Getting Started

To start, download a1.zip from Blackboard and extract the contents. The a1.zip folder contains all the necessary files to start this assignment. Some support code has been provided to assist with implementing the tasks. You will be required to implement your assignment in a1.zip. The other provided file is a1 support.py, which contains some code to help you implement your assignment. You are not compelled to use this file to implement your assignment but it is strongly recommended. Do not make changes to the a1 support.py file. The only file that you should submit is a1.py. It could cause unexpected errors submit more than one file or if you made changes to the a1 support.py file as well. Note: The functionality of your assignment will be marked by automated tests. This means that the output of each function, as well as the output of your overall program, must be exact to the specifications outlined below in the Implementation section. This includes whitespace, grammar, etc. If you add your own messages throughout the game, you will likely fail most of the automated tests. Some sample tests will be provided to give you an idea of whether your output differs from the expected output. These tests are not necessarily the complete set of tests that will be used in marking, so if you pass all sample tests you are not necessarily guaranteed to achieve full functionality marks. However, if you do not pass all sample tests, you are guaranteed not to achieve full functionality marks.


Concepts

At the start of the game the user selects a difficulty, and then a word is chosen at random based on that difficulty. The word length will depend on the difficulty selected by the user; either “FIXED” (meaning the word will be exactly eight letters long), or “ARBITRARY” (meaning the word will be anywhere between six to nine letters long). The goal of the game is for the player to guess that word through a series of guesses of “subwords”. The player will have a different number of guesses (with different subwords to guess; see GUESS INDEX TUPLE ), depending on the difficulty selection. If the player chooses the “FIXED” difficulty, the word must be selected at random from the WORDS FIXED.txt file. If the player chooses the “ARBITRARY” difficulty, the word must be selected at random from the WORDS ARBITRARY.txt file. At program startup, the user is asked to specify one of three actions:




If the user specifies “FIXED”

The game randomly selects an eight-letter word from the WORDS.txt file and the correct guess sequence from the GUESS INDEX TUPLE tuple.

Each vowel guessed in the correct position gets 14 points. Each consonant guessed in the correct position gets 12 points. Each letter guessed correctly but in the wrong position within the substring gets 5 points. You can assume that the words do not contain repeated letters and all guesses are lowercase letters.


If the user specifies “ARBITRARY”

The game randomly selects a word from the WORDS ARBITRARY.txt file and the correct guess sequence from the GUESS INDEX TUPLE tuple. The scoring system is the same as for the ”FIXED” word length.


Guessing procedure


For an eight-letter word

The user will be prompted to guess the word, step by step. The guessing procedure involves 8 steps, where the guess slices will depend on the GUESS INDEX TUPLE. At each of the 7 first steps the user guesses a subsection of the word and receives feedback (their score) for that guess. The final 8th step involves guessing the whole word. After the 8th guess, the user is informed of whether they ‘won’ (i.e. guessed the word correctly) or ‘lost’ (in which case they are told what the word was). If, at any stage, the player enters a guess that is of the incorrect length then the game should repeatedly prompt for the correct word length until the player enters a guess that matches the length of the substring to be guessed in that step. The guessing and scoring procedure is illustrated in Table 2, for the 8 letter word, ”crushing”.



Game over

If the user guesses the correct word at the end of the game, the following message should be printed out:


"You have guessed the word correctly. Congratulations".


If the user guesses the wrong word at the end of the game, the following message should be printed out:


"Your guess was wrong. The correct word was "{word}""


(Where word represents the word the player was trying to guess.)


Examples



Implementation

Within this section, the following variables hold meaning as defined below:

  • word select: A string representing a FIXED or ARBITRARY word selection.

  • guess no: An integer representing how many guesses the player has made.

  • word: A string representing the word being guessed by the player.

  • word length: An integer representing the length of the word being guessed by the player.

You must write the following functions as part of your implementation. You are encouraged to add your own additional functions if they are beneficial to your solution.

select word at random(word select)-> str:

Given the word select is either “FIXED” or “ARBITRARY” this function will return a string randomly selected from WORDS FIXED.txt or WORDS ARBITRARY.txt respectively. If word select is anything other then the expected input then this function should return None.


Hint: see a1 support.load words() and a1 support.random index() create guess line(guess no, word length)-> str:


This function returns the string representing the display corresponding to the guess number integer, guess no.


Example:

>>> cre ate_gu ess_li ne (2 , 8)

’ Guess 2 | - | * | * | * | - | - | - | - | ’


display guess matrix(guess no, word length, scores)-> None:

This function prints the progress of the game. This includes all line strings for guesses up to guess no with their corresponding scores (a tuple containing all previous scores), and the line string for guess no (without a score).

Example:



compute value for guess(word, start index, end index, guess)-> int:

Return the score, an integer, the player is awarded for a specific guess. The word is a string representing the word the player has to guess. The substring to be guessed is determined by the start index and end index. The substring is created by slicing the word from the start index up to and including the end index. The guess is a string representing the guess attempt the player has made.


Example:

>>> compute_value_for_guess("crushing", 0, 1, "rc")

10


main()-> None:

This function handles player interaction. At the start of the game the player should be greeted with the Welcome message. Once the guessing sequence commences the game should loop for the correct number of rounds until either the player wins by guessing the correct word or loses by guessing the incorrect word.


Hint: the main function should be your starting point but also the last function you finish implementing.






ASSESSMENT AND MARKING CRITERIA


Functionality Assessment

The functionality will be marked out of 7. Your assignment will be put through a series of tests and your functionality mark will be proportional to the number of tests you pass. If, say, there are 25 functionality tests and you pass 20 of them, then your functionality mark will be 20/25 ∗ 7. You will be given the functionality tests before the due date for the assignment so that you can gain a good idea of the correctness of your assignment yourself before submitting. You should, however, make sure that your program meets all the specifications given in the assignment. That will ensure that your code passes all the tests. Note: Functionality tests are automated and so string outputs need to exactly match what is expected.


Code Style Assessment

The style of your assignment will be assessed by one of the tutors, and you will be marked according to the style rubric provided with the assignment. The style mark will be out of 3.


ASSIGNMENT SUBMISSION

You must submit your completed assignment electronically through Blackboard. The only file you submit should be a single Python file called a1.py (use this name – all lower case).


Appendix

Welcome Message :


Help message :

"Game rules - You have to guess letters in place of the asterixis.

Each vowel guessed in the correct position gets 14 points.

Each consonant guessed in the correct position gets 12 points.

Each letter guessed correctly but in the wrong position gets 5 points.

If the true letters were "dog", say, and you guessed "hod",

you would score 14 points for guessing the vowel, "o", in the

correct position and 5 points for guessing "d" correctly, but in the

incorrect position. Your score would therefore be 19 points."


Printing Example




If you are looking for solution to exactly this Assignment or any variant assignment of this nature you can contact us.

32 views0 comments

Comentários


bottom of page