This page is also available via https://bit.ly/4hcdYKC

WOD: Surf Score

Take out your WOD-velope and write today’s date and “Surf Score” on your index card.

The World Surf League (WSL) provides the following rules for scoring a surfing competition:

Implement two Typescript classes that together implement these rules for scoring a ride.

The Ride class has the following methods in addition to its constructor:

To simplify things, you may assume that calls to addScore are in order by increasing score. In other words, if the scores are 7.6, 8.3, 7.1, 9.2, and 9.8, then addScore will be called with scores in the following order: 7.1, 7.6, 8.3, 9.2, and 9.8.

IMPORTANT NOTE: For this WOD you may not use functional programming constructs such as `.reduce()` and `.map()`

To complete the WOD you must test your implementation. Start with this:

const ride = new Ride('John John Florence');
ride.addScore(new Score('Pritamo Ahrendt', 9.1));

continue using .addScore() to add the judges scores and output as given in the example. Then, use printAllScores() to print out the scores added. The output should look exactly like the example given for printAllScores() above. Lastly, use .printOverallScore() to get the example given above (again, it should look exactly like the example).

Implementation Note: For addScore(), you will likely want to use Array.push(). For push(), note that it mutates the array by adding the argument to the end of the array. Do not use the return value of push(), as you’ll likely get something you don’t expect.

For example:

const foo = [1, 2, 3];
const result = foo.push(4);
console.log(foo); // Prints: [1, 2, 3, 4]
console.log(result); // Prints: 4

Ready? Let’s begin:

  1. Open TypeScript Playground. You may need to clear the code.

  2. Create Typescript classes according to the specifications above.

  3. Informally test your program by invoking the example code above.

  4. When you are confident your code works correctly, press “Share” to create a URL to your Playground.

  5. Raise your hand to let me know you have finished.

Rx: < 15 min Av: 15 - 21 min Sd: 21 - 25 min DNF: 25+ min             

Submission instructions

After the WOD is over, you will submit your work using Laulima. When you login to your section in Laulima, you should find an open assignment with a title that includes the string Typescript 2 WOD.

Important: Your submission in Laulima must contain the following:

  1. The URL to your Typescript Playground containing your program. Be sure to press the Share button to create the URL.
  2. A copy of your Playground TypeScript code pasted into the body of the submission window.
  3. Copy this sentence exactly “Used AI: [Yes/No]” where you replace [Yes/No] with either “Yes” if you used AI such as ChatGPT or GitHub Copilot, or “No” if you did not use AI any any capacity. This includes using AI enabled search and using AI to generate code, comments, or any other content even if the tool is embedded in your IDE such as Co-pilot.
  4. Copy this sentence exactly “AI Used: [NA/tools used]” where you replace [NA/tools used] with the AI tools you used e.g. ChatGPT, Co-Pilot. If you used multiple tools, list them all. If you did not use AI, then you can leave this as “NA”.

Failure to include all of the above will result in an automatic penalty of no credit for this WOD. This will be strictly enforced.

Important Notes


This page is also available via https://bit.ly/4hcdYKC