alligator eggs!

Download Alligator Eggs!

Post on 07-Sep-2015

216 views

Category:

Documents

0 download

Embed Size (px)

DESCRIPTION

lambda

TRANSCRIPT

  • 7/19/2015 Alligator Eggs!

    http://worrydream.com/AlligatorEggs/ 1/12

    Materials

    Step1:PrintoutthisPDFontosixorsodifferentcoloredsheetsofpaper.(Evenbetter,photocopyitontocardstock.)

    Step2:PrintoutthisPDFontoacouplewhitesheetsofpaper.

    Step3:Cutoutthepieces!

    Pieces

  • 7/19/2015 Alligator Eggs!

    http://worrydream.com/AlligatorEggs/ 2/12

    Thesearehungryalligators:

    Hungryalligatorsarehungry.They'lleatanythingthat'sinfrontofthem!Buttheyarealsoresponsiblealligators,sotheyguardtheirfamilies.

    Theseareoldalligators:

    Oldalligatorsarenothungry.They'veeatenenough.Alltheydoisguardtheirfamilies.

    Theseareeggs:

    Eggshatchintonewfamiliesofalligators!

    Families

    Here'sasmallfamily:

    Agreenalligatorisguardinghergreenegg.

    Here'saslightlybiggerfamily:

  • 7/19/2015 Alligator Eggs!

    http://worrydream.com/AlligatorEggs/ 3/12

    Agreenalligatorandredalligatorareguardingagreeneggandaredegg.Or,youcouldsaythatthegreenalligatorisguardingtheredalligator,andtheredalligatorisguardingtheeggs.

    Here'sahugefamily!

    We'vegotyellow,green,redalligatorsguardingthisfamily.Theyareguardingthreethings:agreenegg,anoldalligator,andaredegg.Theoldalligatorisguardingayelloweggandagreenegg.

    Noticethateggsonlyusethecolorsofthealligatorsguardingthem.Youcan'thaveablueeggwithouttherebeingabluealligatoraroundtoguardit.

    Eating

    Now,thingsaregoingtogetmessy.Herearetwofamilies,sidebyside:

  • 7/19/2015 Alligator Eggs!

    http://worrydream.com/AlligatorEggs/ 4/12

    Thatgreenalligatorsureishungry.Andthere'sayellowfamily,rightinfrontofhermouth,anditlookstasty!

    Ithinkyouknowwhathappensnext.

    Unfortunately,thegreenalligator'seyeswerebiggerthanherstomach.Sheatetoomuch!

  • 7/19/2015 Alligator Eggs!

    http://worrydream.com/AlligatorEggs/ 5/12

    Andsoshedies,andgoesofftoalligatorheaven.But,thestorydoesn'tendthere.Becausethegreenalligatordied,thegreeneggstartstohatch...

    Amazingly,ithatchesintoexactlywhatthegreenalligatorate.It'sthemiracleoflife!

    Now,we'redowntoonefamily.Wehavearedalligatorguardingayellowalligatorandaredegg,andtheyellowalligatorisguardingheryellowegg.

    Butthatyellowalligatorsureishungry,andthere'satastyredegginfrontofher.Herewegoagain...

    Pooralligator.Evenasingleeggistoomuchforherstomach!

  • 7/19/2015 Alligator Eggs!

    http://worrydream.com/AlligatorEggs/ 6/12

    Theyellowalligatordies...butonceagain,theyelloweggstartstohatch...

    Andithatchesintoexactlywhattheyellowalligatorate!

    Now,there'snothingforanyonetoeat,sowestop.

    TheEatingRule

    Thatwasanexampleofthefirstruleofthegame:theeatingrule.

    Theeatingrulesaysthatiftherearesomefamiliessidebyside...

    thetopleftalligatoreatsthefamilytoherright.

  • 7/19/2015 Alligator Eggs!

    http://worrydream.com/AlligatorEggs/ 7/12

    Then,thatalligatordies.Butifshewasguardinganyeggsofthesamecolor,eachofthoseeggshatchesintowhatsheate.

    TheColorRule

    Continuingwiththeexampleabove,theorangealligatoreatstheyellowfamily,leavingthis:

    Now,thegreenalligatoratthetopleftwantstoeatthefamilytoherright.Butbeforeshecandoso,weneedtolookatthecolorrule.

    Thecolorrulesaysthatifanalligatorisabouttoeatafamily,andthere'sacolorthatappearsinbothfamilies,weneedtochangethatcolorinonefamilytosomethingelse.

  • 7/19/2015 Alligator Eggs!

    http://worrydream.com/AlligatorEggs/ 8/12

    Inthepictureabove,greenandredappearinboththefirstandsecondfamilies.So,inthesecondfamily,weswitchallofthegreenstocyan,andalloftheredstoblue.

    Nowthattheydon'tshareanycolors,wecaneat!

    Andeat!

    Andeat!

    Andeat,untilthere'snothingmorethatcanbeeaten.

  • 7/19/2015 Alligator Eggs!

    http://worrydream.com/AlligatorEggs/ 9/12

    OldAlligators

    There'sonlyonemoreruleinthisgame,andithastodowitholdalligators:

    Thetopleftalligatorhereisnothungry.She'snotgoingtoeatanything.Allshecaresaboutisherfamily.So,howdoesshedie?

    Shedieswhenshe'sonlyguardingonething.Rightnow,she'sguardingbothagreenfamilyandaredfamily.Theyneedhertotakecareofthem.Butthatgreenalligatorishungry.Thegreenalligatoreatstheredfamily...

    Now,theoldalligatorisonlyguardingasinglefamily.Thatfamilycantakecareofitself.She'snolongerneeded.So,shegrowsoldanddies.

  • 7/19/2015 Alligator Eggs!

    http://worrydream.com/AlligatorEggs/ 10/12

    Thatistheoldagerule.Whenanoldalligatorisjustguardingasinglething,itdies.

    Now,theredalligatoreatstheyellowfamily,andthere'snomorethatcanbeeaten.

    Gameplay

    Thegamewouldconsistofaseriesofpuzzles,challengingtheplayertodeviseafamilythat,whenfedX,producesY.Forexample:

    Herearetwofamilies.Theyarenamed"True"and"False":

    Andhereisafamilycalled"Not":

    When"Not"eats"True",itproduces"False".Andwhen"Not"eats"False",itproduces"True".Whatcolorsshouldthetwoeggsatthe

  • 7/19/2015 Alligator Eggs!

    http://worrydream.com/AlligatorEggs/ 11/12

    bottombe?

    (Forthistoworkwell,we'dneedabettercolorrule,toexplainthatfamilieswithdifferentcolorsinthesame"pattern"areequivalent.)

    Thesepuzzlescouldbeembeddedintoastory.Theplayerwouldhavetosolveeachpuzzletoseewhathappensnext.Alternatively,thiscouldbemadeintoaboardgame.Eachplayerwouldrolladie,travelforwardanumberofspaces,andsolvethepuzzleatthedestination.

    Theory

    Thisgamerepresentstheuntypedlambdacalculus.Ahungryalligatorisalambdaabstraction,anoldalligatorisparentheses,andeggsarevariables.Theeatingrulecorrespondstobetareduction.Thecolorrulecorrespondsto(overcautious)alphaconversion.Theoldagerulesaysthatifapairofparenthesescontainsasingleterm,theparenthesescanberemoved.

    Variations

    OliverSteelepointedoutthatfamilyrolesareveryimportanttochildren,andmorecouldbemadeoftheconceptofgrandparentalligators,parents,babies(eggs),andsoon.Currently,variablenamesarerepresentedwithcolors.Botharearbitrary,andrequirerenaming/recoloringrulestoavoidcapture.AnalternativemaybesomethinglikedeBruijnindices,correspondingtobirthorderandfamilyrelation.

    Oliveralsosuggestedthatkidsmightnotliketheideaofparentsdying,andperhapsalligatorremovalcouldbeexplainedasmovingaway.

    Bychangingthegamesoalligatorsaregreedy,andeateverythingtotheirright,werepresentarightassociativelambdacalculus.Thisseemstoeliminatealotofoldalligators(parentheses)inChurchnumerals,theYcombinator,etc.Unfortunately,itmeansthatoldalligatorshavetobebornwhenanalligatoreatsmorethanonething,amongotherproblems.I'dstillliketofigureouthowtomakeChurchnumerals(repeatedapplication)looklessugly.

    SchematicForm

    I'vefoundthataschematicformofalligatorcalculusisactuallyratherhandyforcalculatinglambdatermsbyhand.Wedrawalambdaasalinewithamouth.Parenthesesarealinewithoutamouth.Here'stheidentityfunction:

    HerearesomeChurchnumerals:

  • 7/19/2015 Alligator Eggs!

    http://worrydream.com/AlligatorEggs/ 12/12

    HerearebooleanANDandOR(assumingthestandarddefinitionsforTRUEandFALSE):

    TheYcombinator:

    Idon'tknowiftheseareanyeasiertoreadthanthestandardnotation,butI'vefoundthemtobeeasiertoworkwith,usingpencilandpaper.Iimaginethetermseatingoneanotherandhatchingbelow.Idon'tgetlostinalongchainofsymbols,losingtrackofwhat'sapplyingtowhat.