timers and stopwatches - ucl.ac.uk · 10 secsshould react by next costume. this simple script,...
TRANSCRIPT
Openproject4-Stopwatch - ifonline Saveasacopyandaddyourname- ifoffline Saveasandaddyourname
Exploretheproject.Lookatthesetupscriptaswellasthecostumes ofthe1secs sprite.
Duplicate the1secsspriteandrenameto10secs.Duplicate twomoretimesandrenameto1minsand10mins.Updateallsetupscripts.
MODULE 4:INVESTIGATION 2Activity4.2.1– BuildaStopwatch
3
MODULE 4:INVESTIGATION 2Activity4.2.1– BuildaStopwatch
4
u Timeisrepresentedusingthesamedigitcostumesasthepreviousinvestigation,howevertheplacevaluesaredifferent.Whatisthesameandwhatisdifferentbetweenthetwomodels?
u Whathappenswhen1secs getsto0again?Doesitnudge10secs?
Forthe1secsspritebuildabehaviour:wait1secsthendisplaynextcostume.Dothisforever.Addthehatblock:
Note: 1secs willbetheonlyspritewithwhenthisspriteclicked,otherswillreactonlytobroadcasting.
Likeearlier,makethe1secssprite‘nudge’10secs spritewhenappropriate,i.e.whenitreachesitslastcostume.
MODULE 4:INVESTIGATION 2Activity4.2.1– BuildaStopwatch
5
10secs shouldreactbynextcostume.Thissimplescript,however,mustbeextendedaswell:whenappropriate10secswillbroadcastitsmessage– add1min.
1minsspritewillreact.Completeanddebugthescriptsofallfourdigits.
MODULE 4:INVESTIGATION 2Activity4.2.1– BuildaStopwatch
6
u Whathappens1secondafter00:59?
u Whichcostumesdoes10secs actuallyneed?
u Haveyoudeletedorskippedtheothercostumes?
MODULE 4:INVESTIGATION 2Activity4.2.1– BuildaStopwatch
7
Areyourscriptssimilartothebelow?Discussanyalternativesolutions.
[Extension]Measuretheaccuracyofthestopwatchanddiscuss.
[Extension]Explorehowtomakethetimepassmorequicklyorslowly.
[Extension]Extendyourstopwatchtoshowamoreaccuratetimebyshowingtenthsofseconds.
MODULE 4:INVESTIGATION 2Activity4.2.1– Extension:BuildaStopwatch
8
u Doesitworkproperly?Ifnot,whydoyouthinkthatis?
u Howwouldthemodelworkifyouextendedittoincludehours?Howmanycostumeswouldeachspriteneed?
ACTIVITY 4.2.2
Unplugged:NudgeNudge GetGet
MODULE 4:INVESTIGATION 2Activity4.2.2– Unplugged:NudgeNudge GetGet
9
Threepupilsstandatthefront(hundreds,tensandones).
Settheinitialnumberbygivingeachpupilaflipbook–pupilsatthefrontmustnotseeeachothers’flipbooks,everyoneelsemustchecktheydon’tcheat!
Agreeatargetnumber– teacherexplainstherules.
Playthegame!
MODULE 4:INVESTIGATION 2Activity4.2.2– Unplugged:NudgeNudge GetGet
hundreds tens ones
10
MODULE 4:INVESTIGATION 2Activity4.2.2– Unplugged:NudgeNudge GetGet
11
u Canyouexplainwhatyouhaveseenduringthisactivity?
u Whatisthesmallest(orthelargest)numberofrollsofthedietogetfrom111to90.Howcanwecalculatethis?
Openproject4-Timer - ifonline Saveasacopyandaddyourname- ifoffline Saveasandaddyourname
Exploretheproject. Lookatthescriptsofeachofthesprites1secs,10secs and1mins.
MODULE 4:INVESTIGATION 2Activity4.2.3– CountdownConundrum
u Howcanwesettheinitialtime?E.g.3:25?Or1:58?
13
Settheinitialtimee.g.to3minutes25seconds...…bychangingthevaluesoftheswitchcostumeto...blocksinthesetupscripts.
Forthe1secsspritemakeanewblockcalledpreviouscostume todecreaseitsvalue(i.e.costume)byone.
MODULE 4:INVESTIGATION 2Activity4.2.3– CountdownConundrum
14
Exploreandcomparebyclicking:
For1secsspritebuildascript:whenthisspriteclicked itwillwait1secsthendisplayitspreviouscostumeagainandagaininaforever loop.
MODULE 4:INVESTIGATION 2Activity4.2.3– CountdownConundrum
u Whatshouldhappenwhenthe1secs spritereaches0andwantstodecreaseby1?
15
For1secs:beforeitgoestopreviouscostume,itchecksifithasnotalreadyreached0andifithasitbroadcastsamessageget10secs.Onlythenitdecreasesitsvalue.
Copythepreviouscostumedefinitionintothe10secsspritebydraggingitfrom1secs.
MODULE 4:INVESTIGATION 2Activity4.2.3– CountdownConundrum
16
u Whowillreacttothemessageget10secs?How?
Forthe10secsspritebuildascriptthatwilldecreaseitsnumber(i.e.costume#)by1whenitreceivesget10secsmessage.
MODULE 4:INVESTIGATION 2Activity4.2.3– CountdownConundrum
u Whatshouldhappenwhenthe10secs spritereaches0?Whenexactlyshoulditask1minstoget‘more’?Whatshould10secs‘flip’itscostumeto?
17
Extendthescriptof10secs:beforeitgoestopreviouscostume itmustcheckwhetheritneedstogetextrafrom1mins– bybroadcastingget1min.
Buildcorrectreactionof1mins.
Debugallscripts,experimentwith‘quicker’or‘slower’timepassing.
MODULE 4:INVESTIGATION 2Activity4.2.3– CountdownConundrum
18
u Will1mins needthedefinitionofpreviouscostume aswell?Whathappensafter2:01?Andthenextsecond?
[Extension]Whathappenswhenyourtimergetsto0:00(or00:00ifyouadded10mins)?
Thinkofastrategy(algorithm)tomakeyourtimerstopatthatpoint.Youmayneedtheblock:
Youmayalsoneedtoreplace‘simplegetting’bymore‘safegetting’– whenaspritebroadcastsamessage,itmaywaittoensurethereactionissuccessfullycompleted.Forthis,usethesecondtypeofbroadcastblock:
MODULE 4:INVESTIGATION 2Activity4.2.3– [Extension]CountdownConundrum
19
Openproject4-Dials - ifonline Saveasacopyandaddyourname- ifoffline Saveasandaddyourname
Exploretheproject. Lookatthescriptsofeachofthesprites1secs,10secs,1mins,secondshand andminuteshand.
Runtheprojectbyclickingthegreenflagthenclicking1secs.
MODULE 4:INVESTIGATION 2Ext.Activity4.2.4– DizzyDials
u Whatnewspritesdoyouhave?
21
Explorethesecondshandsprite.Notepointindirection0blockinitssetupscript.Exploreseveralsimilarblockslike:
Wewantsecondshandtofollowbroadcastsfrom1secs.Inthe1secsspriteaddthebehaviourtobroadcast themessagetick everysecond,i.e.eachtimethecostume#increasesby1.
MODULE 4:INVESTIGATION 2Ext.Activity4.2.4– DizzyDials
22
u Howshouldthesecondhandreact?
Forthesecondshand spritebuildascripttoturnright…degreeseachtimeitreceivesthemessagetick.
Nowexploretheminuteshand.Whydon’tweseeit?Makeitvisible.Canitturnaswell? Explore.
MODULE 4:INVESTIGATION 2Ext.Activity4.2.4– DizzyDials
23
u Whatangleshouldthesecondshandspriteturnafteronesecondhaspassed?Why?
Intheminuteshand spritebuildascripttoturnright…degreeseachtimeitreceivesthemessageadd1min – itisalreadybeingbroadcastby10secs:
Testoutyourdials!
MODULE 4:INVESTIGATION 2Ext.Activity4.2.4– DizzyDials
24
u Whenshouldtheminutehandspriteturn?Howcanwetellittoturnatthatpoint?
u Whatangleshouldtheminuteshandspriteturnafteroneminutehaspassed?Why?
[Advancedextension]Explorethegotofront blocktoensuretheminuteshandisinfrontofthesecondshand.
[Advancedextension]Edittheprojectsothatwhenthesecondhandturnsitgraduallyfillsthedialwithcolour.
Hint: Secondshandisnormalspriteandassuchitcanalsodraw.Setitspensizeandcolourproperlyandmakethespritedrawalinethenmovebackandonlythenturn.Experimentandexplore.
MODULE 4:INVESTIGATION 2Ext.Activity4.2.4– DizzyDials
25
MyInvestigation2 checklist:
Ibuiltastopwatchthatcountsupinsecondsandminutes.
[Extension]Ichangedthespeedofmystopwatch.
[Extension]Iaddedtenthsofsecondstomystopwatch.
Ibuiltatimerthatcountsdowninsecondsandminutes.
Ibuiltanewblockpreviouscostume thatswitchesthesprite’scostumetothepreviousone.
[Extension]Istoppedmytimerat0:00.
[Extension]Ibuiltananalogueclockthatmirrorsthesametimeasmydigitaldisplay.
MODULE 4:INVESTIGATION 2
26