trig prom challenge - cs.duke.edu › csed › web › alice09 › tutorials ›...

6
Trig Prom Challenge Michael Hoyle Susan Rodger Duke University - 2012

Upload: others

Post on 07-Jul-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Trig Prom Challenge

Michael HoyleSusan Rodger

Duke University - 2012

Trig Prom Challenge

Story:Fred told his prom date he would meet her

under the disco ball at midnight for a dance. Now the time has come but he needs your help

to find her!

Use what you know about trigonometry to get him to his date!

Trig Prom Challenge

Getting Started:You should be using trigDiscoBall.a2w. If you play the world now, Fred walks towards his date but doesn't quite make it there. This is

because the world function, howFar, is incomplete. Currently he only moves forward 1

meter, but he want him to move to her.

Trig Prom Challenge

Objective:Complete the world function howFar

(distanceToDiscoBall, heightOfDiscoBall) to figure out how far he needs to move to get to

his date.

Return the distance Fred needs to walk to get under the disco ball.

Trig Prom Challenge

Parameters:

heig

htO

fDis

coB

all

distanceToDiscoBall

Return this length

Trig Prom Challenge

Hints, Tips, and Useful Information:● Use Pythagorean's theorem to help you find

the correct distance.● Press Space while playing the world to reset

Fred to a new random distance to try your algorithm again.