CS代考 CS106 W22 – Assignment 02 Due: Friday, January 21, 11:59 PM

CS106 W22 – Assignment 02 Due: Friday, January 21, 11:59 PM
Note: On each assignment we will be running a program called MOSS to detect cheating. MOSS compares your assignment to: all other students in CS106 this semester, code on the internet, and code from CS106 in previous years.
Assignment 2 is graded out of 22 marks.
You are to write a JavaScript p5 program to mimic what you see in the video:

Copyright By PowCoder代写 加微信 powcoder

https://vault.cs.uwaterloo.ca/s/qKHgtP9xKAFAwbM
wordle is a free game on the internet: https://www.powerlanguage.co.uk/wordle/
Begin with this starter code: https://openprocessing.org/sketch/1441201
CS 106 | Winter 2022 | Assignment 02 | Page 1 of 5

Requirements and Grading You will create two sketches, A2_basic and A2_enhanced.
In A2_basic, you will implement as much required functionality as you can without any enhancements. Your goal is to match the video demonstration. This is the sketch the markers will evaluate for required functionality marks. Do this first.
In A2_enhanced, you can extend and deviate somewhat from the required functionality to show off your programming skill and design creativity. Do this second.
Required Functionality A2_basic: [ 12 marks]
For A2_basic we suggest you proceed as follows:
Examine the starter code in detail, to ensure you understand it as this will give you insights into how to use the starter code with the code your write. Your requirements are:
• The sketch is 400×400. The text font is “Courier New”. The background is 220. The text size is 40. The word “wordle” and the wordle url are shown at the top.
• [ 2 marks ] Write a keyPressed function that takes one character at a time from the keyboard. When it receives “wordLength” characters it calls a function ”wordle”. “wordle” has a string of length “wordLength” as its only parameter. “wordLength” is in the starter code. In the starter code it has a value of 5.
You may assume the user only presses the letters of the alphabet in lowercase a-z (never uppercase A-Z). You can assume the user doesn’t type anything else such as punctuation
• [ 2 marks ] When we test your program it should work for any word of length 3, 4, 5, 6, or 7. This is set in the variable “wordLength” in the starter code. See the video.
• [ 6 marks ] Write a “wordle” function that compares the characters that have been type in with a global variable called “myWord” (see “myWord in the starter code”). The function “wordle” does not return a value.
CS 106 | Winter 2022 | Assignment 02 | Page 2 of 5

o As in the game “wordle” on the internet, your function “wordle” color codes the letters to show the following:
▪ Black means the character is not in myWord.
▪ Yellow means the character is in myWord but in a different location.
▪ Green means the character is in myWord and in the correct location.
▪ Your function “wordle” displays myWord and the color coded characters (see the image above and the video).
• [2marks] When we test your program it should function correctly regardless of what word is in “myWord”. “myWord” may be a combination of lowercase and uppercase. The letters that the user types are always lowercase, but the word in “myWord” may have lowercase and uppercase.
[ 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.
[ 6 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 A2_enhanced.
CS 106 | Winter 2022 | Assignment 02 | Page 3 of 5

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 6 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 out of 3, and if it is well done you get 4-6 marks. For example, if you add a splash screen with only the words “press any key to continue” then you would get 1 out of 6. To get 6 out of 6 you must do much more such as adding three enhanced features such as adding a nice splash screen, improving the look of the game significantly, and adding sound or animations.
The idea of this enhancement is that you’ll enjoy enhancing your wordle game. Hope you do.
Submitting
Use the template file in Word “CS106 Assignment Template” in LEARN (under Assignment 01) to create your Assignment 02 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:
CS 106 | Winter 2022 | Assignment 02 | Page 4 of 5

Submit that pdf file to the Assignment 02 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 02 | Page 5 of 5

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com