Escape Room 3.15 - Hacks & Extensions
Extended challenges and hacks for CSP 3.15 Escape Room - Random Values
π Escape Room Hacks & Extensions
π Master Level Challenges π
Go beyond the escape room with advanced Random Value challenges!
π Overview
Congratulations on completing the escape room! These hacks are designed to:
- Extend your learning with more advanced algorithms
- Apply concepts to real-world scenarios
- Create your own string manipulation challenges
- Explore optimization and algorithm design
π― Hack Categories:
- π₯ Fire Hacks: Required challenges (choose 2/3)
- π Diamond Hacks: Advanced optional challenges
- π¨ Creative Hacks: Design your own problems
Hacks
π₯ Fire Hacks (choose 2/3)
Pseudocode Challenge Questions
-
Write the description about Randomness in computing and the definition of RANDOM(a,b).
- Pseudocode Random Values practice, generate your own Pseudocode function and define the possible values generated, then give the specific proability of each value
# For example, write a pseudocode function that will give you 7 for a chacne of 20 times when you run 100 times
-
Pseudocode/Concept Practice, given RANDOM(3,7), what values can be produced?
-
What is the probability of getting 4 from RANDOM(3,7)?
-
If Random (4,4) is called, what is the output and its probability?
- If you run Random(3,7) 100 times, how many times would you expect to get a 6?
Python Version Questions
- Write the description of random_range(start, end)
# Describe what this function does and its parameters
- Simulate rolling two dice and show all possible sum outcomes
# Die faces: 1, 2, 3, 4, 5, 6 # Write code to show all possible sums when rolling two dice
- Create a fortune teller where βTry Againβ appears 40% of the time
# Other responses: "Yes", "No", "Maybe" # Write code where "Try Again" has 40% probability
-
If we run random.randint(1,10) 1000 times, about how many 3βs would we expect?
-
What is the difference between random.randint(a,b) and random.choice(list)? Give an example of each.
- Write a Python code that rolls 2 dice and prints their sum.
JavaScript Version Questions
- Write the description of getRandomInRange(min, max)
//Describe what this function does and its parameters
- Simulate drawing two cards from values 1-10 and show all possible total values
// Card values: 1 through 10 // Write code to show all possible totals when drawing two cards
- Create a decision maker where βDefinitelyβ appears 30% of the time
// Other responses: "Probably", "Unlikely", "Never" // Write code where "Definitely" has 30% probability
-
Write JavaScript code to simulate 10 coin flips, where 0 = Heads and 1 = Tails.
- What does this code output, and what is the range of the possible values?
JS
let num = Math.floor(Math.random() * 8) + 1;
console.log(num);
π Diamond Hacks(optional)
Create a function that takes an object with decision options and their desired probabilities (as percentages), and returns a randomly selected decision based on those weights.
π¨ Creative Hacks
You can create your own question if you want and commit it to us if you want