Okay, I tooktheverticalredcoder, I attachedittothisguy, and I putitbehindthescreen.
I thinkitshouldwork.
Let's tryitout.
Nice.
ItactuallyfeelslikeFlappyBirdalready.
Thenextstepistogeneratethepipes.
Sincewehavepipescomingfromthetopandthebottom, youmightthinkit's easiesttojustgeneratelike a randomlengthpiperighthere, andthenanotherrandomlengthpiperighthere, andthatwouldlooksomethinglikethis.
But I think a betterwaytogeneratethemwouldbetogenerateonegiantlineandthenpick a randomhole, right?
Becauseonceyouhavethisline, ifyoujustpick a randomhole, likesayyoupickhere, thereyougo.
Thoseareyourtwopipes.
Tophysicallymovethepipesacrossthescreen, I think I'm justgoingtouse a systemlikethis.
It's actuallyprettysimple.
Wejusthaveanobserverchainandthen a bunchofobserverscomingoffofthatchain.
Wheneveryougiveitanupdate, itgivesyou a nicethree-widepulseacrosstheselamps.
Okay, I stackeditup a littlebitand I simulated a littlesystemtoseewhatthepipesmightlooklike.
Yeah.
I mean, thatlooksprettygood.
Myonlyconcernisthatthismightbe a littlebittoofast.
I mean, thesearemovingprettyfastacrossthescreenandconsideringourbirdonlyfallsthatfast, I don't thinkit'llmixwellwiththosepipes.
But I mean, atthesametime, youcanalsojustmakethebirdfall a littlebitfasterbymakingthisclock a littlebitshorter.
So I'm notthatconcerned.
Youknowtoofast.
Thiswould, evenifthebirdwasatthesamepaceanditwasfallingreallyfast, this, I don't thinkFlappyBirdismeanttobe, meanttobethiscrazy.
Atleastnotuntilyougettothelaterlevelsorwhatever.
So I'm goingtohavetothinkof a differentsystemtomovethepipesacross.
Okay.
I justhad a thought.
Whatifweputrepeatersonthebackofthese?
They'reonewide.
So, oh, okay.
That's, that's muchbetter.
Checkitout.
Dude.
OhmyGod.
I can't believehoweasythatwastofix.
Allright.
Solike I saidbefore, foreachsetofpipes, we'rejustgoingtocreateonelongcolumnandthengenerate a randomhole.
Tome, when I hearonelongcolumnand a randomholeinit, thatkindofremindsmeoftheverticalredcoderagain, becauseifyoujustinvertthis, nowitlookslikeonelongcolumnwith a holeinit.
So I thinkif I canfind a waytomodifythistomaketheholebigger, that'llbeperfect.
Okay.
I'vebeenworkingonit a littlebit.
I think I'vegotsomethingpromising.
Soifweinput a signallikethat, weget a holerighthere.
Andifweinput a differentsignalstrength, maybeyouwant a littlebithigher.
Weget a holethat's higherup.
Okay.
Thatseemsprettycool.
All I didherewastaketheoutputfromtheredcoderandmakeitgoup a slabtowerby a designatedamount.
Soforexample, I thinktheoutput's comingfromaboutrighthereandyoucanseeitcameoutwith a singlestrengthofseven, meaningthatit's goingtogouplikethisandcreate a hole.
That's onlysevenlong.
Everythingelsestillhastorchesonit.
Okay.
I hookedupthefancyobserverscreentoit.
Andnowwe'llactuallybeabletoseethepipesrightnow.
It's setatthiscurrentheight.
Andifwepressthisbutton, itreleasesit.
Andthat's whatthepipeslooklike.
That's actuallyprettygood.
Wecangooverhereandwecanchangetheheight.
Wecandosomethinglikethisinstead, pressthebuttonandweget a differentheight.
Awesome.
Afterplayingwithitfor a while, I noticedthatsometimestheholesareliketoohighandtheychopoffthetoppipe.
Butifitoutputsthestackable, whichisthedust, it's onlygoingtooutput a onesignalstrength, whichdoesnotreachthelamp.
Solet's activatethreeoftheseatonce.
Andthatwayit's goingtogenerate a randomthreebitbinarynumber, whichmeansit's goingtobe a randomnumberintherangezerotosevenorzero, zero, zerotoone, one, one, zero, one, two, three, four, five, six, seven.
Canyouseewhere I'm goingwiththis?
Allwehavetodoisuse a decodertodecodethethreebitbinarynumberintoitscorrespondingtorchzerothroughseven.
Andnowwiththreerandomizersand a decoder, wecanchoose a randomtorcheverytimewepressthisbutton.
Okay.
I made a littlecircuittoautomateitandcheckitout.
Randompipes.
Let's putthisthingontheclock.
Ohyeah.
Thatisamazing.
Allright.
We'vegotpipes.
We'vegot a bird.
Let's trytocombinethem.
Okay.
Slightproblem.
And I probablyshouldhaveseenthisonecoming, buttheobserversdon't mixverywellwiththeredcodeorlike, I can't bringtheseobserversacrosshere, whichmeansthatthepipesjustkindofdisappearassoonastheyreachthebirdscolumn.
I'm surethere's a wayaroundthisthough.
I mighthavetoredesignsomething, but I'llletyouknowwhat I figureout.
Andwhat's reallycoolabouttheseiswhenyoustackthemnexttoeachother, like I have, wheneveronegoesfromninetozero, itincrementstheonetoitsleftbyone, makingthis a fullyworkingcounterallthewayupto 9,999.
Sorighthere, when a pipegetsallthewaytotheendofthescreen, I putinthiswire, whichincrementsourscorebyone.
Andthatisaboutit.
I'd saythatwehave a workingFlappyBirdgame.
Nowthateverythingisworking, I'm goingtodo a fewfinalthingsbefore I'm finished.