Somyworkaroundforthiswas I installed a packageandsublimecalledSupplyMaripl I'llput a linkinthedescriptionofhowtoinstallthis, and I canruntheinputfunctionthroughthat.
Sonowyoucanseeplayeronemakeyourselectionthree, anditdoesn't doanythingwiththatinputrightnow, butyoucanseethatit's askingmethatand I cantypeinenter.
Andonething I'llnotethatwillprobablychangein a futurevideoisthatit's kindofgettingmessymycoat a littlebitwithjustthrowingtheserandomnumbershereallthewayallovertheplace.
Andprogrammingisthatcalledmagicnumbers.
Youkindofdon't knowwheretheycomefrom, so I'llcleanthoseupinsomeofthefuturevideosintheseries.
We'reexpectingtosee a connectfourboardkindofbebuildingfrombottomup.
Soprintboardandwejustneed a passontheboard.
Andwhatwe'regonnadoisthere's a commandanddumpy.
Sothecommandis I mean, justrememberit.
ItisNPDflip I wantedtoboard, andthenyouhavetoflipitoveryettospecifytheaxisof a zerotheaccessWe'regonnafliptheboardovertheexaccesssothatshouldgetitupsidetherightsideupagain.
Andtodothat, we'llhave a loopthatgeneratesoverthecolumns.
Sofor C incalledrangecolumncount.
Andsowedefined a columncountuphereaboveinthatseven.
Andonethingah, I thinkwouldbe a coolchallengeforyouguystotry.
That I don't thinkmygameisgoingtobeabletodoatthispointintimeis a verywelldesigned, likeconnectfourgame.
Youwouldbeabletochangethesenumbers.
So, like, I couldchangeittosay, like, 12 orsomethingandthistoelikeeightandthegamewouldstillbeabletowork.
Youstillhave, like, a connectfourgame, butjust a biggerboard.
Andsothat's whatkindof a coolwaytomakesure.
Likeyou'vedesignedthings a smartwaywhereyoudon't havejusttheserandom, likemagicnumberspoppingupallovertheplaceandactuallygonnachangethisrealquicktohrohaccountandcolumncountJustcause I wouldn't trytoeliminatethemagicnumberswhere I canandwe'llcleanthisuptoo.
Like, wouldbe a coolchallengeforyouguystotrytobuildthesefunctionssothattheycouldbeanynumberofcolumns, anynumberofrowsinanynumberofpiecesforthewinninglength.
I actuallyaddedoneadditionalrowbecause I wantedthisspotwhere I coulddisplaythiscirclethat I'm droppingsowe'llactuallymakethisrowaccountplusonetimessquaresizefortheheightandthatwillbepackagedtogethernicelyin a variablecalledsize, whichwillbe a topullofwithcommaheightandthentogetpiegametoactuallyreadthatweneedtotypeinthefollowingscreenequalspigamedotdisplaygotsetmodeandthenwillhaveitreadinthesize.
Soifeventdottypeequalsequalspigamedotmouse, buttondownandallofthedifferenteventsyoucanalsofindonthepiegamewebsiteunderthedocks, thegameisgonnarunbyusclickingdownon a specificspotinthescreenwherewewanttodropthepiece.
So I'm gonnareallyquickputallofthisallofthisbehaviorintothismousebuttondowneventtypebecausenowtheeventsofusdroppingthepeacealwayshappenwhenweclickthemousebuttondownsowedon't wantittohappen.
otherwise, wedon't wantittobeaskingforthis.
Inputwrites a columnequalsandthisisgonnabewhereweclickonthescreen.
Obviously, Um, sowe'regonnaimplementthedropawardfunctionnow, soifyouthinkaboutit, I'lldraginthefinishone I haveagainruin a draw, somesortofrectangleforeachoftheseslotsandthen a blackcircleinsidethoserectangles.
Andthenwe'llhavetodrawthisafterwards.
Thispiecethatwedrop.
Andthenwheneverwedodrop a piece.
Theoneortwothat's inourcommandlinebasedgamewanttobecomelike a redcircleor a yellowcirclebasedonwhatwe'redoing.
Sowe'regonnadrawthatonthescreen, and I'm gonnadraginagainthethelie, thelibraryso I canseeexactlywhat I'm doing.
So I wasgoingtoseeherepiegameaboutdrywallwreckedWeneedtotakeinthesurfacethecolortherectanglewewanttodrawandthenthewithSothescreenisthesurfacewe'rein a droughtonthecoloriswewant a bluecolorSo I'm gonnadefineblueas a globalvariableGlobalstaticvariableupaboveThisisgonnabeanRGBvalue.
There's gonnabe C timessquaresizebecausewewanttheactualThisisthetopleftcornerofit, andthat's goingtotheAndthenourpositiononthe Y axisisgonnabeourtimes.
Sodownhere, we'lljustdo a drawboardtakingtheboard a CZwedidhereandthenwhatwehavetodowheneverwewanttoupdateourdisplayisdupigamedotdisplaydotupdateand I willmakesurethatweactuallyseewhatwe'resupposedtosaysowe'llbuildthatrealquick.
Andtheoneproblem I seerightnowisit's notactuallyopeningup.
The I wantedthetoptobeopensowecouldhave a piecethatah, swingsaroundit.
Soitshowsuswherewe'redroppingit.
So I thinktheproblemwiththatisbecauseouraccessstartsat 00 Weactuallyneedahtoshiftdownbyonesquaresizetokindofaccountforthatoffsetthatweleftforthatspace.
Sowe'llhavetoadd a squaresizehere.
Now I buildthisagain, andasyoucansee, itlooksproper.
Nowwe'llneed a fillinsomecirclestorepresentthetheslots.
We'lldothatbydrawing a circleonpiegame, andthat's alsointhedocumentationswithpiegamedotdrawdotcircleandthat's gonnatakeinthesurfaceof a screen.
Andnowweneedahcolor.
So I think a goodcolorwouldbejustblack, sowelldefined, blackupabovetwoandblackandRGBisjustzero.