• simulation: is an imitation of a situation or process
  • Advantages:
    • Can be safer
    • More cost-effective
    • More efficient
    • More data in less time
  • Disadvantages:
    • Not as accurate as experiments
    • outside factors not included (ex: in rolling dice simulation gravity and air resistance)

Hack 1

Example Stimulation: Pendulum Stimulation

A pendulum stimulation can be used to teach students about oscillation and power/work in physics. This software is beneficial for physics teachers because it does not require the cost of buying the equipment for the lab. It also ensures that the data is more accurate in contrast to in real life physics labs where there is human error.

Hack 2

questions_number = 6
answers_correct = 0
questions = [
    "True or False: Simulations will always have the same result. \n A: True, \n B: False",
    "True or False: A simulation has results that are more accurate than an experiment \n A: True, \n B: False",
    "True or False: A simulation can model real world events that are not practical for experiments \n A: True, \n B: False",
    "Which one of these is FALSE regarding simulations \n A: Reduces Costs, \n B: Is safer than real life experiments, \n C: More Efficient, \n D: More accurate than real life experiments",
    "Which of the following scenarios would be the LEAST beneficial to have as a simulation \n A: A retail company wants to identify the item which sold the most on their website, \n B: A restaurant wants to determine if the use of robots will increase efficiency, \n C: An insurance company wants to study the impact of rain on car accidents, \n D: A sports car company wants to study design changes to their new bike design ",
    "Which of the following is better to do as a simulation than as a calculation \n A: Keeping score at a basketball game, \n B: Keeping track of how many games a person has won, \n C: Determining the average grade for a group of tests, \n D: Studying the impact of carbon emissions on the environment"
]
question_answers = [
    "B",
    "B",
    "A",
    "D",
    "A",
    "D"
]

print("Welcome to the Simulations Quiz!")

def ask_question (question, answer):
    print("\n", question)
    user_answer = input(question)
    print("You said: ", user_answer)

    if user_answer == answer:
        print("Correct!")
        global answers_correct
        answers_correct = answers_correct + 1
    else:
        print("You are incorrect")
    
for num in range(questions_number):
    ask_question(questions[num], question_answers[num])

print("You scored: ", answers_correct, "/6")
Welcome to the Simulations Quiz!

 True or False: Simulations will always have the same result. 
 A: True, 
 B: False
You said:  B
Correct!

 True or False: A simulation has results that are more accurate than an experiment 
 A: True, 
 B: False
You said:  B
Correct!

 True or False: A simulation can model real world events that are not practical for experiments 
 A: True, 
 B: False
You said:  A
Correct!

 Which one of these is FALSE regarding simulations 
 A: Reduces Costs, 
 B: Is safer than real life experiments, 
 C: More Efficient, 
 D: More accurate than real life experiments
You said:  D
Correct!

 Which of the following scenarios would be the LEAST beneficial to have as a simulation 
 A: A retail company wants to identify the item which sold the most on their website, 
 B: A restaurant wants to determine if the use of robots will increase efficiency, 
 C: An insurance company wants to study the impact of rain on car accidents, 
 D: A sports car company wants to study design changes to their new bike design 
You said:  A
Correct!

 Which of the following is better to do as a simulation than as a calculation 
 A: Keeping score at a basketball game, 
 B: Keeping track of how many games a person has won, 
 C: Determining the average grade for a group of tests, 
 D: Studying the impact of carbon emissions on the environment
You said:  D
Correct!
You scored:  6 /6

Hack 3

What makes it a simulation?

  • This is a stimulation because instead of rolling dice in real life, this stimulation is a model of the dice rolling, which would produce a number that is achieved from the random integer. What are it’s advantages and disadvantages?
  • Advantages:
    • cost effective: don't need to buy dice
    • more efficient: takes less time to generate number and don't have to wait until dice is finished rolling
    • can generate data immediately
  • disadvantages:
    • isn't as fun as rolling the dice In your opinion, would an experiment be better in this situation?
  • I think code would be better because the results are produced instantly and can save time

Game of Life - Lydia & Ava

Below is a simulation of the Game of Life, originally written by John Horton Conway. Mr. Mortensen has this game on the APCSP site and we think that it is a great example of an interactive simulation.

What it is

  • This game is an unpredictable cellular automaton
  • automaton = simulates and imitates human life, hence why this is called the game of life
  • After creating the initial configuration, the game evolves without pattern

How it works

  • Cells in this game are alive or dead, similar to binary where they are on or off
  • The user created an initial configuration of cells on the grid, and presses play (tap the squares on the grid)
  • a cells's status (alive or dead, on or off) depends on the surrounding 8 cells status (surrounding 8 boxes). Here are the rules:
    • The birth rule= a dead cell (blue box) that is surrounded by at least 3 alive cells (yellow boxes), will become alive
    • The death rule= an alive cell (yellow) with no or only one surviving cell around it dies (becomes blue)
    • Cell survival= an alive cell (yellow) with 2 or 3 alive neighboring cells will stay alive

Try it Out!

Use the grid below to create cell figurations, press play, and watch your cells die, live, and move around!

Hack #4

Created new function that takes sum of dice rolled

def parse_input(input_string):
    if input_string.strip() in {"1", "2", "3","4", "5", "6"}:
        return int(input_string)
    else:
        print("Please enter a number from 1 to 6.")
        raise SystemExit(1)

import random

def roll_dice(num_dice):
    roll_results = []
    for _ in range(num_dice):
        roll = random.randint(1, 6)
        roll_results.append(roll)
    return roll_results

## New function to add sum of dice rolled
def total(list):
    total = 0
    for number in list:
        number = int(number)
        total += number
    return total


num_dice_input = input("How many dice do you want to roll? [1-6] ")
num_dice = parse_input(num_dice_input)
roll_results = roll_dice(num_dice)
sum = total(roll_results)

print("you rolled:", roll_results) 
print("The sum of your rolled dice is: ", sum)
import random

shirts = ["floral", "white", "red", "blue", "green"]
shoes = ["airforce1", "boots", "sneakers", "slippers", "jordans"]
pants = ["jeans", "tights", "cargo pants", "shorts", "sweatpants"]

def rand_int(list):
    index = random.randint(0, len(list)-1)
    return index

rand_shirt = shirts[rand_int(shirts)]
rand_shoes = shoes[rand_int(shoes)]
rand_pants = pants[rand_int(pants)]
print(f"You should wear a {rand_shirt} shirt, {rand_pants}, and {rand_shoes}. ")
You should wear a red shirt, jeans, and airforce1. 

This code is a stimulation for choosing an outfit. This is a stimulation because it is a model of the choices one has to go through to choose an outfit for the day. The advantages are that it produces an immediate response as opposed to some people who are indecisive. Disadvantages are that the outfits do not match the weather conditions and may not match in general. In my opinion, a real life experimentation would be better because people can pick clothes based on their liking.