CS106 W22 – Assignment 06
Due: Friday, March 4, 11:59 PM Assignment 6 is graded out of 30 marks.
In CS106 this semester we have been using a file ”words.txt”. It has a few hundred thousand English words. In this assignment we are also using a French diction “francais.txt” which also has a few hundred thousand words.
This assignment, like Assignment 2, is based on the word game called Wordle.
Copyright By PowCoder代写 加微信 powcoder
Starter code contains the two dictionary files: https://openprocessing.org/sketch/1496213 Mimic what you see in this video: https://vault.cs.uwaterloo.ca/s/rFgSZWfRYN5cCY5
You are to create a sketch to do the following.
Set the background to gray and canvas size to 800×400.
a) [ 2 marks ] Load the two files “words.txt” and “francais.txt”.
b) [ 5 marks ] Select a random 5-letter English word. Print that word to the console so that as we are grading we can see that word. Call this ”hiddenWord”. Convert “hiddenWord” to uppercase (see the video).
c) [ 2 marks ] Allow the player to type in a 5-letter word. Call this “guessWord”. Your keyPressed() or keyTyped() function should ignore all key presses except for the letter a-z and A-Z.
Hint: You may have an “if” in keyPressed() or keyTyped() that looks something like this:
o If the letter in guessWord is not in hiddenWord, the letter is black.
CS 106 | Winter 2022 | Assignment 06 | Page 1 of 3
if (key >= “a” && key <= "z")
The player can type in lowercase and uppercase letters but “guessWord” should be uppercase (see the video).
d) [ 5 marks ] For each letter in the guessWord, compare it to the hiddenWord, letter by letter.
o If the letter in guessWord is in hiddenWord but not in the correct location, the letter is yellow.
o If the letter in GuessWord is in hiddenWord and in the correct location, the letter is green.
Display the guessWord using those colours colours (see the video).
e) [ 5 marks ] This game is in English. But just to practice using multiple dictionaries we have added the following. If guessWord (we know guessWord is in words.txt and thus we know it is an English word) happens to be in the French dictionary, then we text a message to the canvas (see the video).
Hint: Using multiple dictionaries is one question on the Final Exam so we have put it
here in A6 to allow you to practice with multiple dictionaries.
f) [ 2 marks] If the player guesses the hiddenWord then a message is displayed saying “You win, game over”, and all future key presses are ignored.
Note: For the “basic” requirements in this assignment you give the player one guess only. Wordle allows six guesses, and perhaps as an enhancement you could enhance the sketch to allow six guesses. But for the “basic” version of this assignment only allow one guess.
[ 4 marks ] Coding Style and Efficiency
Coding style is evaluated in all sketches.
Follow the course coding style for whitespace and comments. Consult the “Code Style Guide” on LEARN.
1) [ 0.5 ] Include your name and student ID number at the beginning of your code.
2) [ 0.5 ] Comment your code appropriately. Avoid superfluous comments.
3) [ 0.5 ] Correctly and consistently indent your code blocks.
4) [ 0.5 ] Use correct inline spacing.
5) [ 0.5 ] Use good line spacing to chunk sections of your code.
6) [ 0.5 ] All variable names are meaningfully chosen.
7) [ 0.5 ] No variables are declared but not used.
8) [ 0.5 ] You may not use any functions or statements not covered in lecture or labs. This
includes, but is not limited to:
• No translate(), rotate(), or scale() functions.
CS 106 | Winter 2022 | Assignment 06 | Page 2 of 3
[ 5 marks ] Functionality or Visual Design Enhancements
Once you have basic functionality working (the “correctness” requirements above), enhance the functionality or the visual design in a sketch called A6_enhanced.
In comments at the top of your code, you must document your enhancements so that the person grading knows what enhancements you made.
To get these 5 marks for enhancements you must clearly demonstrate your use of JavaScript p5 and/or your creativity. If it is not done you get 0, if it is minimally done you get 1-2 out of 5, and if it is well done you get 3-5 marks.
Submitting
Use the template file in Word “CS106 Assignment Template” in LEARN (under Assignment 01) to create your Assignment 06 submission for your 2 sketches.
Then convert your Word file to pdf. Please ensure that your URLs are hot links. The TAs need to be able to click on each link in your pdf and go directly to your sketch.
So for example, don’t have a link like this: https://openprocessing.org/sketch/1050954
but rather have that link as a hot link as follows: https://openprocessing.org/sketch/1050954 Ensure that each URL you submit has its settings so that the access is as follows:
Submit that pdf file to the Assignment 06 dropbox on LEARN.
An example of how to do submit a Lab or Assignment sketch is shown in the following video from
Lab 0: https://vault.cs.uwaterloo.ca/s/MgPD3pBEMjmHQYz
CS 106 | Winter 2022 | Assignment 06 | Page 3 of 3
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com