fix(curriculum): add examples in dice game step 14 (#56733)

This commit is contained in:
Kamal Singh
2024-10-19 00:34:08 +05:30
committed by GitHub
parent 27e8bf9da0
commit edebaeffc2

View File

@@ -7,7 +7,7 @@ dashedName: step-14
# --description--
For the last portion of the game, you will need to create an algorithm that checks for the presence of a straight. A small straight is when four of the dice have consecutive values in any order (`Ex. 1234`) resulting in a score of `30` points. A large straight is when all five dice have consecutive values in any order (`Ex. 12345`) resulting in a score of `40` points.
For the last portion of the game, you will need to create an algorithm that checks for the presence of a straight. A small straight is when four of the dice have consecutive values in any order (Ex. in a roll of `41423`, we have `1234`) resulting in a score of `30` points. A large straight is when all five dice have consecutive values in any order (Ex. in a roll of `35124`, we have `12345`) resulting in a score of `40` points.
Declare a `checkForStraights` function which accepts an array of numbers. If the user gets a large straight, update the fifth radio button with a score of `40`. If the user gets a small straight, update the fourth radio button with a score of `30`. If the user gets no straight, update the last radio button to display `0`.