Inspiration

What it does

How I built it

Challenges I ran into

Accomplishments that I'm proud of

What I learned

What's next for Daily Dose of Scene Card

import random into random

from random import random from random import randint

define constants

COINVALUE = 50 COINDIAMETER = 2 COINRADIUS = COINDIAMETER/2

define variables

boardDIAMETER = 50 reward = 1500

inside the rectangle has to be set to 0 first because no coins have been tossed yet

insiderectangle = 0

j = randint(1,365) for i in range(j):

# define x and y
#multiply the random function and the square diameter to scale it
#x is the x coordinate and y is the y coordinate
x = random() * boardDIAMETER
y = random() * boardDIAMETER

#Monte Carlo simulation
#add the coin radius to x to see if it will be bigger than the square diameter.  if it is bigger then that means it lands on the line and the customer  loses
if (x + COINRADIUS > boardDIAMETER):
    continue
#subtract coin radius from x to see if it will be smaller than the square diameter.  if it is smaller then that means it lands on the line and the customer loses
elif (x - COINRADIUS < 0):
    continue
#add the coin radius to y to see if it will be bigger than the square diameter.  if it is bigger then that means it lands on the line and the customer  loses
if (y + COINRADIUS > boardDIAMETER):
    continue
#subtract coin radius from y to see if it will be smaller than the square diameter.  if it is smaller then that means it lands on the line and the customer loses
elif (y - COINRADIUS < 0):
    continue
print("day",(i))
#if the whole coin lands inside the rectangle without touching the line, then the customer wins. and you increment 1 everytime this happens.
insiderectangle = insiderectangle + 1

(Inside rectangle) is how many times the customer wins

multiply that by the coinvalue then subtract how many wins there are by the reward

this is to find out how much money is gained or lost

estimate = insiderectangle*COINVALUE - (i-insiderectangle) * reward

if estimate > 0: print("For playing this game", (j), "times a year, consumer loses ",(estimate), "scene points")

else: print ("For playing this game", (j), "times a year consumer gains", (abs(estimate)),"scene points") print("That's",(abs(estimate)//1000), "free movies!") print("$", (abs(estimate)//500) * 5, "off food and drinks at the movies") print("$", (abs(estimate)//1000), "free concession combo") print("$",(abs(estimate)//1000) * 10, "off Swiss Chalet, Harvey's, Montana's, East Side Mario's, Milestones and more!")

Share this project:

Updates