def createTopGrowMod(name,tst): topGrowMod = tam3.Module(name) #tile templates for Top Grow Module lsbIncTop = tam3.TileTemplate(name="lsbIncTop") msbIncTop = tam3.TileTemplate(name="msbIncTop") interiorIncTop = tam3.TileTemplate(name="intIncTop") lsbCpTop = tam3.TileTemplate(name="lsbCpTop") msbCpTop = tam3.TileTemplate(name="msbCpTop") interiorCpTop = tam3.TileTemplate("interiorCpTop") tiles = [lsbPortTop,msbPortTop,interiorPortTop,msbTransTop,intTransTop,lsbTransTop,lsbIncTop,msbIncTop,interiorIncTop,lsbCpTop,msbCpTop,interiorCpTop] addTileTemplatesToModule(tiles, topGrowMod) topGrowMod.join(1, N, lsbPortTop, interiorPortTop, tst, portFill = "pF") topGrowMod.join(1, N, interiorPortTop, interiorPortTop, tst, portFill = "pF") topGrowMod.join(1, N, interiorPortTop, msbPortTop, tst, portFill = "pF") topGrowMod.join(2, E, lsbPortTop, lsbIncTop, tst, lsbIncBitTop = "0*") topGrowMod.join(1, E, msbPortTop, msbIncTop, tst, msbIncBitTop = "*0") topGrowMod.join(1, E, interiorPortTop, interiorIncTop, tst, intBitTop = "0") #joins For copy tile templates in top grow module topGrowMod.join(1, E, lsbIncTop, lsbCpTop, tst, lsbCpBitTop = ("0*","1*")) topGrowMod.join(1, S, interiorCpTop, lsbCpTop, tst, cpSigTop = "x") topGrowMod.join(2, E, lsbCpTop, lsbIncTop, tst, lsbIncBitTop = ("0*","1*")) topGrowMod.join(1, E, interiorIncTop, interiorCpTop, tst, intBitTop = ("0","1")) topGrowMod.join(1, S, msbCpTop, interiorCpTop, tst, cpSigTop = "x") topGrowMod.join(1, S, interiorCpTop, interiorCpTop, tst, cpSigTop = "x") topGrowMod.join(1, E, interiorCpTop, interiorIncTop, tst, intBitTop = ("0","1")) topGrowMod.join(2, E, msbIncTop, msbCpTop, tst, msbCpBitTop = ("*1","*0")) topGrowMod.join(2, E, msbIncTop, msbTransTop , tst, msbCpBitTop = ("A*")) topGrowMod.join(1, E, msbCpTop, msbIncTop, tst, msbIncBitTop = ("*0","*1")) #Joins for Inc tile templates in top grow module topGrowMod.join(1, N, lsbIncTop, interiorIncTop, tst, incSigTop = ("n","c")) topGrowMod.join(1, N, interiorIncTop, interiorIncTop, tst, incSigTop = ("n","c")) topGrowMod.join(1, N, interiorIncTop, msbIncTop, tst, incSigTop = ("n","c")) topGrowMod.join(1, E, interiorIncTop, intTransTop, tst, intBitTop = "0") topGrowMod.join(1, E, lsbIncTop, lsbTransTop, tst, lsbCpBitTop = "0*") #Joins for Transition Top Tiles in top grow module topGrowMod.join(1, S, msbTransTop, intTransTop, tst, transTop = "tTop") topGrowMod.join(1, S, intTransTop, intTransTop, tst, transTop = "tTop") topGrowMod.join(1, S, intTransTop, lsbTransTop, tst, transTop = "tTop") lsbCpTop.addTransition(inputs=("lsbCpBitTop","cpSigTop"), outputs=("lsbIncBitTop"),table={("0*","x"):("0*"), ("1*","x"):("1*")}) lsbIncTop.addTransition(inputs=("lsbIncBitTop"), outputs=("lsbCpBitTop","incSigTop"), table={("1*",) : ("0*","c"), ("0*",):("1*","n")}) msbCpTop.addTransition(inputs=("msbCpBitTop"), outputs=("msbIncBitTop","cpSigTop"), table={("*1",):("*1","x"), ("*0",):("*0","x")}) msbIncTop.addTransition(inputs=("msbIncBitTop","incSigTop"), outputs=("msbCpBitTop"), table={("*1","c"):("A*"),("*0","c"):("*1"), ("*1","n"):("*1"),("*0","n"):("*0")}) interiorCpTop.addTransition(inputs=("cpSigTop","intBitTop"), outputs=("cpSigTop","intBitTop"),table={("x","1"):("x","1"),("x","0"):("x","0")}) interiorIncTop.addTransition(inputs=("intBitTop","incSigTop"), outputs=("intBitTop","incSigTop"), table={("1","c"):("0","c"),("1","n"):("1","n"),("0","c"):("1","n"),("0","n"):("0","n")}) return topGrowMod
def createTransTuringMod(name, tst): transTuringMod = tam3.Module(name) tiles = [leftBeg, middleBeg, rightBeg, leftCont, middleCont, rightCont] addTileTemplatesToModule(tiles, transTuringMod) transTuringMod.join(2, E, leftBeg, middleBeg, tst, begSig="b") transTuringMod.join(2, E, middleBeg, rightBeg, tst, rbegSig="rb") transTuringMod.join(1, E, leftCont, middleCont, tst, contSigM="cSM") transTuringMod.join(1, E, middleCont, middleCont, tst, contSigM="cSM") transTuringMod.join(1, E, middleCont, rightCont, tst, contSigM="cSM") return transTuringMod
def createBottomRightSquareMod(name,tst): bottomRightSquareMod = tam3.Module(name) #Bottom Right Square Module Tile Template fillerH = tam3.TileTemplate(name="fillerH") fillerG = tam3.TileTemplate(name="fillerG") topH = tam3.TileTemplate(name="topH") topG = tam3.TileTemplate(name="topG") intBotRightFill = tam3.TileTemplate(name="intBotRightFill") msbBotRightFill = tam3.TileTemplate(name="msbBotRightFill") tiles = [msbBotRight,lsbBotRight,intBotRight,fillerG,fillerH,topG,topH,intBotRightFill,msbBotRightFill] addTileTemplatesToModule(tiles, bottomRightSquareMod) bottomRightSquareMod.join(1, W, msbBotRight, intBotRight, tst, bRFill = 0) bottomRightSquareMod.join(1, W, intBotRight, intBotRight, tst, bRFill = 0) bottomRightSquareMod.join(1, W, intBotRight, lsbBotRight, tst, bRFill = 0) #Tile Templates Bottom Right Square bottomRightSquareMod.join(2, S, msbBotRight, topG, tst, gSig = "G") bottomRightSquareMod.join(1, S, intBotRight, topH,tst, hFill = "h") bottomRightSquareMod.join(1, S, intBotRight, fillerH,tst, hFill = "h") bottomRightSquareMod.join(2, S, topH, topG,tst, gSig = "G") bottomRightSquareMod.join(1, W, topG, topH,tst, iSig = "i") bottomRightSquareMod.join(1, S, topG, fillerG,tst, gFill = "g") bottomRightSquareMod.join(1, E, topG, fillerG,tst, gFillHoriz = "g") bottomRightSquareMod.join(1, S, fillerG, fillerG, tst, gFill = "g") bottomRightSquareMod.join(1, E, fillerG, fillerG,tst, gFillHoriz = "g") bottomRightSquareMod.join(1, S, fillerH, topH,tst, hFill = "h") bottomRightSquareMod.join(1, W, topH, fillerH,tst, hFillHoriz = "h") bottomRightSquareMod.join(1, S, fillerH, fillerH,tst, hFill = "h") bottomRightSquareMod.join(1, W, fillerH, fillerH,tst, hFillHoriz = "h") bottomRightSquareMod.join(1, W, fillerH, intBotRightFill,tst, hFillHoriz = "h") bottomRightSquareMod.join(1, W, topH, intBotRightFill,tst, hFillHoriz = "h") bottomRightSquareMod.join(1, W, topG, msbBotRightFill,tst, iSig = "i") bottomRightSquareMod.join(1, S, lsbBotRight, intBotRightFill, tst, lMS = 0) bottomRightSquareMod.join(1, S, intBotRightFill, intBotRightFill, tst, lMS = 0) bottomRightSquareMod.join(1, S, intBotRightFill, msbBotRightFill, tst, lMS = 0) return bottomRightSquareMod
def createLeftTransitionMod(name,tst): leftTransitionMod = tam3.Module(name) #Tile Templates For Left Transition Module topA = tam3.TileTemplate(name="topA") topB = tam3.TileTemplate(name="topB") topFillerA = tam3.TileTemplate(name="topFillerA") topFillerB = tam3.TileTemplate(name="topFillerB") tiles = [msbTransSeed, interiorTransSeed, lsbTransSeed, interiorFlipperSeed, msbFlipperSeed, topA, topB, topFillerA, topFillerB] addTileTemplatesToModule(tiles, leftTransitionMod) #Joins for beginning seeds of left transition module leftTransitionMod.join(1, E, msbTransSeed, interiorTransSeed, tst, leftTransSeed = 0) leftTransitionMod.join(1, E, interiorTransSeed, interiorTransSeed, tst, leftTransSeed = 0) leftTransitionMod.join(1, E, interiorTransSeed, lsbTransSeed, tst, leftTransSeed = 0) #Joins for tile templates in left transition module leftTransitionMod.join(2, N, msbTransSeed, topA, tst, aSig = "A") leftTransitionMod.join(1, N, interiorTransSeed, topB, tst, bFill = "b") leftTransitionMod.join(1, N, interiorTransSeed, topFillerB, tst, bFill = "b") leftTransitionMod.join(1, N, lsbTransSeed, interiorFlipperSeed, tst, intFlip = "iF") leftTransitionMod.join(1, N, interiorFlipperSeed, msbFlipperSeed, tst, intFlip = "iF") leftTransitionMod.join(1, N, interiorFlipperSeed, interiorFlipperSeed, tst, intFlip = "iF") leftTransitionMod.join(1, E, topA, topB, tst, cSig = "c") leftTransitionMod.join(2, N, topB, topA, tst, aSig = "A") leftTransitionMod.join(1, N, topA, topFillerA, tst, aFill = "a") leftTransitionMod.join(1, W, topA, topFillerA, tst, aFillHoriz = "a") leftTransitionMod.join(1, N, topFillerB, topB, tst, bFill = "b") leftTransitionMod.join(1, N, topFillerA, topFillerA, tst, aFill = "a") leftTransitionMod.join(1, W, topFillerA, topFillerA, tst, aFillHoriz = "a") leftTransitionMod.join(1, E, topFillerB, topFillerB, tst, bFillHoriz = "b") leftTransitionMod.join(1, E, topB, topFillerB, tst, bFillHoriz = "b") leftTransitionMod.join(1, N, topFillerB, topFillerB, tst, bFill = "b") leftTransitionMod.join(1, E, topFillerB, interiorFlipperSeed, tst, bFillHoriz = "b") leftTransitionMod.join(1, E, topA, msbFlipperSeed, tst, cSig = "c") return leftTransitionMod
def createRightTransitionMod(name,tst): rightTransitionMod = tam3.Module(name) #Right Transition Module Tile Templates fillerE = tam3.TileTemplate(name="fillerE") fillerD = tam3.TileTemplate(name="fillerD") topE = tam3.TileTemplate(name="topE") topD = tam3.TileTemplate(name="topD") tiles = [msbStartSeed, intStartSeed, lsbStartSeed, intFlipStartSeed, msbFlipStartSeed, fillerE, fillerD, topE,topD] addTileTemplatesToModule(tiles, rightTransitionMod) rightTransitionMod.join(1, S, msbStartSeed, intStartSeed, tst, transStartTop = "tSTop") rightTransitionMod.join(1, S, intStartSeed, intStartSeed, tst, transStartTop = "tSTop") rightTransitionMod.join(1, S, intStartSeed, lsbStartSeed, tst, transStartTop = "tSTop") #Joins For Tile Templates in Right Transition Module rightTransitionMod.join(2, E, msbStartSeed, topD, tst, dSig = "D") rightTransitionMod.join(1, E, intStartSeed, topE,tst, eFill = "e") rightTransitionMod.join(1, E, intStartSeed, fillerE,tst, eFill = "e") rightTransitionMod.join(1, S, topD, topE,tst, tSig = "t") rightTransitionMod.join(1, E, topD, fillerD,tst, dFill = "d") rightTransitionMod.join(1, N, topD, fillerD,tst, dFillerVert = "d") rightTransitionMod.join(1, E, fillerD, fillerD,tst, dFill = "d") rightTransitionMod.join(1, N, fillerD, fillerD,tst, dFillerVert = "d") rightTransitionMod.join(1, E, fillerE, topE,tst, eFill = "e") rightTransitionMod.join(1, S, topE, fillerE,tst, eFillVert = "e") rightTransitionMod.join(2, E, topE, topD,tst, dSig = "D") rightTransitionMod.join(1, E, fillerE, fillerE,tst, eFill = "e") rightTransitionMod.join(1, S, fillerE, fillerE,tst, eFillVert = "e") rightTransitionMod.join(1, S, fillerE, intFlipStartSeed,tst, eFillVert = "e") rightTransitionMod.join(1, S, topE, intFlipStartSeed, tst,eFillVert = "e") rightTransitionMod.join(1, S, topD, msbFlipStartSeed,tst, tSig = "t") rightTransitionMod.join(1, E, lsbStartSeed, intFlipStartSeed, tst, fSS = 0) rightTransitionMod.join(1, E, intFlipStartSeed, intFlipStartSeed, tst, fSS = 0) rightTransitionMod.join(1, E, intFlipStartSeed, msbFlipStartSeed, tst, fSS = 0) return rightTransitionMod
def createTuringMod(name, tst): turingMod = tam3.Module(name) mainTM = tam3.TileTemplate("mainTM") transTM = tam3.TileTemplate("transTM") rightFiller = tam3.TileTemplate("rightFiller") leftFiller = tam3.TileTemplate("leftFiller") endMainTM = tam3.TileTemplate("endMainTM") extendLine = tam3.TileTemplate("extendLine") tiles = [ mainTM, transTM, rightFiller, leftFiller, leftFillerSignificant, endMainTM, extendLine, leftSeedTuringCont, middleSeedTuringCont, rightSeedTuringCont, seedLeft, seedMiddle, seedRight, transToPortLeft, transToPortMiddle, transToPortRight ] addTileTemplatesToModule(tiles, turingMod) extendToBotTran = tam3.TileTemplate("extendToBotTran") toBotFill = tam3.TileTemplate("toBotFill") toBotSkipModPre = tam3.TileTemplate("toBotSkipModPre") toBotSkipMod = tam3.TileTemplate("toBotSkipMod") toBotSkipBottomModPre = tam3.TileTemplate("toBotSkipModPre") toBotSkipBottomMod = tam3.TileTemplate("toBotSkipMod") turingMod.add(extendToBotTran) turingMod.add(toBotFill) turingMod.add(toBotSkipModPre) turingMod.add(toBotSkipMod) turingMod.add(toBotSkipBottomModPre) turingMod.add(toBotSkipBottomMod) turingMod.join(1, E, seedLeft, seedMiddle, tst, seed="seed1") turingMod.join(1, E, seedMiddle, seedRight, tst, seed2="seed2") turingMod.join(2, N, seedLeft, mainTM, tst, tmSig="q10*") turingMod.join(1, N, seedMiddle, transTM, tst, nextSig="0") turingMod.join(1, N, seedMiddle, rightFiller, tst, nextSig="0") turingMod.join(1, N, seedRight, rightFiller, tst, nextSig="-") turingMod.join(1, E, leftSeedTuringCont, middleSeedTuringCont, tst, midCont="midCont") turingMod.join(1, E, middleSeedTuringCont, middleSeedTuringCont, tst, midCont="midCont") turingMod.join(1, E, middleSeedTuringCont, rightSeedTuringCont, tst, midCont="midCont") turingMod.join(2, N, leftSeedTuringCont, mainTM, tst, tmSig="q10*") turingMod.join(1, N, middleSeedTuringCont, transTM, tst, nextSig="0") turingMod.join(1, N, middleSeedTuringCont, rightFiller, tst, nextSig="0") turingMod.join(1, N, rightSeedTuringCont, rightFiller, tst, nextSig="-") #Joins for TM turingMod.join(1, E, mainTM, transTM, tst, nextState=("q1", "q2")) turingMod.join(1, N, mainTM, leftFillerSignificant, tst, lSigUp="F*") turingMod.join(1, N, mainTM, leftFiller, tst, lSigUp="F") turingMod.join(1, W, mainTM, leftFillerSignificant, tst, lSigWest="L") turingMod.join(1, W, mainTM, leftFiller, tst, lSigWest="L") turingMod.join(1, N, rightFiller, transTM, tst, nextSig=("0", "-")) turingMod.join(2, N, transTM, mainTM, tst, tmSig=("q20", "q10")) turingMod.join(2, N, transTM, endMainTM, tst, tmSig=("q1-", "q2-")) turingMod.join(1, E, transTM, rightFiller, tst, rSigEast="R") #Joins For Right Filler turingMod.join(1, E, rightFiller, rightFiller, tst, rSigEast="R") turingMod.join(1, N, rightFiller, rightFiller, tst, nextSig=("0", "-")) #Joins For Left Filler turingMod.join(1, W, leftFiller, leftFiller, tst, lSigWest="L") turingMod.join(1, W, leftFiller, leftFillerSignificant, tst, lSigWest="L") turingMod.join(1, N, leftFiller, leftFiller, tst, lSigUp="F") turingMod.join(1, N, leftFiller, transToPortMiddle, tst, lSigUp="F") #Joins For Left Filler Significant turingMod.join(1, N, leftFillerSignificant, leftFillerSignificant, tst, lSigUp="F*") turingMod.join(1, N, leftFillerSignificant, transToPortLeft, tst, lSigUp="F*") #Joins for End TM Main turingMod.join(1, W, endMainTM, leftFiller, tst, lSigWest="L") turingMod.join(2, E, endMainTM, extendLine, tst, extendSig=("R", "A")) turingMod.join(1, N, endMainTM, transToPortMiddle, tst, lSigUp="F") #Joins for trans to port tiles turingMod.join(2, N, extendLine, transToPortRight, tst, endSig=("R-", "A-")) turingMod.join(1, W, transToPortRight, transToPortMiddle, tst, transHorizSig="L1") turingMod.join(1, W, transToPortMiddle, transToPortMiddle, tst, transHorizSig="L1") turingMod.join(1, W, transToPortMiddle, transToPortLeft, tst, transHorizSig="L1") turingMod.join(2, S, extendLine, extendToBotTran, tst, extToBot=("tbA", "tbR")) turingMod.join(1, S, extendToBotTran, toBotFill, tst, extToBotF=("tbA", "tbR")) turingMod.join(1, S, toBotFill, toBotFill, tst, extToBotF=("tbA", "tbR")) turingMod.join(1, E, rightFiller, toBotFill, tst, rSigEast="R") turingMod.join(1, E, transToPortRight, toBotFill, tst, rSigEast="R") turingMod.join(1, E, extendLine, toBotFill, tst, rSigEast="R") turingMod.join(1, E, extendToBotTran, toBotFill, tst, rSigEast="R") turingMod.join(1, E, toBotFill, toBotFill, tst, rSigEast="R") turingMod.join(1, E, toBotSkipMod, toBotFill, tst, rSigEast="R") turingMod.join(1, E, toBotSkipModPre, toBotFill, tst, rSigEast="R") turingMod.join(1, S, toBotFill, toBotSkipModPre, tst, extToBotF=("tbA", "tbR")) turingMod.join(1, E, rightSeedTuringCont, toBotSkipModPre, tst, skipSig="sS") turingMod.join(2, S, toBotSkipModPre, toBotSkipMod, tst, extToBotSkip=("tbA", "tbR")) turingMod.join(1, S, toBotSkipMod, toBotFill, tst, extToBotF=("tbA", "tbR")) turingMod.join(1, E, seedRight, toBotSkipBottomModPre, tst, botSkip="bS") turingMod.join(1, S, toBotFill, toBotSkipBottomModPre, tst, extToBotF=("tbA", "tbR")) turingMod.join(2, S, toBotSkipBottomModPre, toBotSkipBottomMod, tst, extToBotSkipBottom=("A", "R")) turingMod.join(1, E, toBotSkipBottomModPre, toBotSkipBottomModPre, tst, botSkip="bS") mainTM.addTransition(inputs=("tmSig"), outputs=("nextState", "lSigUp", "lSigWest"), table={ ("q10*", ): ("q2", "F*", "L"), ("q10", ): ("q2", "F", "L"), ("q20", ): ("q1", "F", "L") }) transTM.addTransition(inputs=("nextState", "nextSig"), outputs=("tmSig", "rSigEast"), table={ ("q1", "0"): ("q10", "R"), ("q2", "0"): ("q20", "R"), ("q2", "-"): ("q2-", "R"), ("q1", "-"): ("q1-", "R") }) rightFiller.addTransition(inputs=("rSigEast", "nextSig"), outputs=("rSigEast", "nextSig"), table={ ("R", "0"): ("R", "0"), ("R", "-"): ("R", "-") }) endMainTM.addTransition(inputs=("tmSig"), outputs=("extendSig", "lSigUp", "lSigWest"), table={ ("q1-", ): ("A", "F", "L"), ("q2-", ): ("R", "F", "L") }) extendLine.addTransition(inputs=("extendSig"), outputs=("endSig", "extToBot", "rSigEast"), table={ ("R", ): ("R-", "tbR", 'R'), ("A", ): ("A-", "tbA", "R") }) transToPortRight.addTransition(inputs=("endSig"), outputs=("portContRight"), table={ ("R-", ): ("R-"), ("A-", ): ("A-") }) extendToBotTran.addTransition(inputs=("extToBot"), outputs=("extToBotF", "rSigEast"), table={ ("tbA", ): ("tbA", "R"), ("tbR", ): ("tbR", "R") }) toBotFill.addTransition(inputs=("extToBotF", "rSigEast"), outputs=("extToBotF", "rSigEast"), table={ ("tbA", "R"): ("tbA", "R"), ("tbR", "R"): ("tbR", "R") }) toBotSkipModPre.addTransition(inputs=("extToBotF", "skipSig"), outputs=("extToBotSkip", "rSigEast"), table={ ("tbA", "sS"): ("tbA", "R"), ("tbR", "sS"): ("tbR", "R") }) toBotSkipMod.addTransition(inputs=("extToBotSkip"), outputs=("extToBotF", "rSigEast"), table={ ("tbA", ): ("tbA", "R"), ("tbR", ): ("tbR", "R") }) toBotSkipBottomModPre.addTransition(inputs=("extToBotF", "botSkip"), outputs=("extToBotSkipBottom", "botSkip"), table={ ("tbA", "bS"): ("A", "bS"), ("tbR", "bS"): ("R", "bS") }) return turingMod
def createLeftCounterMod(name, tst): leftCounterMod = tam3.Module(name) skipTile = tam3.TileTemplate("skipTile") extendTileLeft = tam3.TileTemplate("extendTileLeft") leftFillLeft = tam3.TileTemplate("leftFillLeft") middleFillLeft = tam3.TileTemplate("middleFillLeft") shiftToExtend = tam3.TileTemplate("shiftToExtend") topFillLine = tam3.TileTemplate("topFillLine") topSkip = tam3.TileTemplate("TopSkip") tiles = [ botFillTile, topPreSkip, rightFillLeft, contLeftStart, contLeftStartTwo, initialTile, skipTile, extendTileLeft, leftFillLeft, middleFillLeft, shiftToExtend, topFillLine, topSkip ] addTileTemplatesToModule(tiles, leftCounterMod) leftCounterMod.join(2, N, initialTile, skipTile, tst, skipBotSig="sBS") leftCounterMod.join(1, N, skipTile, botFillTile, tst, skipBotSigFill="sBSF") leftCounterMod.join(1, N, botFillTile, botFillTile, tst, skipBotSigFill="sBSF") leftCounterMod.join(1, N, botFillTile, contLeftStart, tst, skipBotSigFill="sBSF") leftCounterMod.join(2, W, contLeftStart, extendTileLeft, tst, extendSig="eS") leftCounterMod.join(1, N, contLeftStart, topPreSkip, tst, toTopPreSkip="tTPS") leftCounterMod.join(1, N, contLeftStartTwo, topPreSkip, tst, toTopPreSkip="tTPS") leftCounterMod.join(2, N, topPreSkip, topSkip, tst, topSkipSigSKip="tSSS") leftCounterMod.join(1, N, topFillLine, middleFillLeft, tst, topSkipSig="tSS") leftCounterMod.join(1, N, shiftToExtend, middleFillLeft, tst, topSkipSig="tSS") leftCounterMod.join(1, N, extendTileLeft, leftFillLeft, tst, leftMostSig="lMS") leftCounterMod.join(1, N, leftFillLeft, leftFillLeft, tst, leftMostSig="lMS") leftCounterMod.join(1, W, topSkip, leftFillLeft, tst, horizFill="hF") leftCounterMod.join(1, W, rightFillLeft, leftFillLeft, tst, horizFill="hF") leftCounterMod.join(1, N, topSkip, rightFillLeft, tst, topSkipSig="tSS") leftCounterMod.join(1, N, rightFillLeft, rightFillLeft, tst, topSkipSig="tSS") leftCounterMod.join(1, W, rightFillLeft, middleFillLeft, tst, horizFill="hF") leftCounterMod.join(1, W, middleFillLeft, middleFillLeft, tst, horizFill="hF") leftCounterMod.join(1, W, topPreSkip, middleFillLeft, tst, horizFill="hF") leftCounterMod.join(1, W, topPreSkip, leftFillLeft, tst, horizFill="hF") leftCounterMod.join(1, W, middleFillLeft, leftFillLeft, tst, horizFill="hF") leftCounterMod.join(1, N, rightFillLeft, contLeftStartTwo, tst, topSkipSig="tSS") leftCounterMod.join(1, N, middleFillLeft, middleFillLeft, tst, topSkipSig="tSS") leftCounterMod.join(1, N, middleFillLeft, topFillLine, tst, topSkipSig="tSS") leftCounterMod.join(1, N, leftFillLeft, shiftToExtend, tst, leftMostSig="lMS") leftCounterMod.join(1, W, contLeftStartTwo, topFillLine, tst, topFillSig="tFS") leftCounterMod.join(1, W, topFillLine, topFillLine, tst, topFillSig="tFS") leftCounterMod.join(1, W, topFillLine, shiftToExtend, tst, topFillSig="tFS") leftCounterMod.join(2, W, shiftToExtend, extendTileLeft, tst, extendSig="eS") return leftCounterMod
portFromTuringFill, portToLeftFill, tst, toBotLeftFill="tBLF") mod2.join(1, W, portToLeftFill, botFillTile, tst, toBotLeftFill="tBLF") mod2.join(1, W, portToLeftFill, rightFillLeft, tst, toBotLeftFill="tBLF") mod2.join(1, W, portToLeftFill, topPreSkip, tst, toBotLeftFill="tBLF") if __name__ == '__main__': #create mandatory tile set template tst = tam3.TileSetTemplate() #create root module rootMod = tam3.Module("rootMod") alphabet = ['0', '1', '_'] # The list of state names of the TM states = ['q1', 'q2', 'qA', 'qR'] startState = 'q1' # The state in which the machine starts acceptState = 'qA' # The state into which the machine moves in order to halt and accept rejectState = 'qR' # The state into which the machine moves in order to halt and reject # A full transition table mapping every input in every state to an output symbol, direction, and state transitions = { ('q1', '0'): ("q2", "0", "R"), ("q2", "0"): ("q1", "0", "R"), ("q1", "*0"): ("q2", "*0", "R"),
def createBottomLogGrowMod(name,tst): bottomLogGrowMod = tam3.Module(name) #seed tile templates seed1 = tam3.TileTemplate(name="Seed1") seed2 = tam3.TileTemplate(name="Seed2") seed3 = tam3.TileTemplate(name="Seed3") seed4 = tam3.TileTemplate(name="Seed4") seed5 = tam3.TileTemplate(name="Seed5") seed6 = tam3.TileTemplate(name="Seed6") #tile templates to grow the bottom left module -- growth using binary lsbCp = tam3.TileTemplate(name="lsbCp") lsbInc = tam3.TileTemplate(name="lsbInc") msbCp = tam3.TileTemplate(name="msbCp") msbInc = tam3.TileTemplate(name="msbInc") interiorCp = tam3.TileTemplate(name="intCp") interiorInc = tam3.TileTemplate(name="intInc") tiles = [seed1,seed2,seed3,seed4,seed5,seed6,lsbCp,lsbInc,msbCp,msbInc,interiorCp,interiorInc,msbTrans,interiorTrans,lsbTrans] addTileTemplatesToModule(tiles, bottomLogGrowMod) bottomLogGrowMod.join(2, W, seed1, seed2, tst, seed1 = "s1") bottomLogGrowMod.join(2, W, seed2, seed3, tst, seed2 = "s2") bottomLogGrowMod.join(2, W, seed3, seed4, tst, seed3 = "s3") bottomLogGrowMod.join(2, W, seed4, seed5, tst, seed4 = "s4") bottomLogGrowMod.join(2, W, seed5, seed6, tst, seed5 = "s5") bottomLogGrowMod.join(2, N, seed1, lsbInc, tst, lsbIncBit = "0*") bottomLogGrowMod.join(1, N, seed2, interiorInc, tst, intBit = "0") bottomLogGrowMod.join(1, N, seed3, interiorInc, tst, intBit = "0") bottomLogGrowMod.join(1, N, seed4, interiorInc, tst, intBit = "0") bottomLogGrowMod.join(1, N, seed5, interiorInc, tst, intBit = "0") bottomLogGrowMod.join(1, N, seed6, msbInc, tst, msbIncBit = "*0") #Joins For the copy bottomLogGrowMod.join(1, N, lsbInc, lsbCp, tst, lsbCpBit = ("0*","1*")) bottomLogGrowMod.join(1, E, interiorCp, lsbCp, tst, cpSig = "x") bottomLogGrowMod.join(2, N, lsbCp, lsbInc, tst, lsbIncBit = ("0*","1*")) bottomLogGrowMod.join(1, N, interiorInc, interiorCp, tst, intBit = ("0","1")) bottomLogGrowMod.join(1, E, msbCp, interiorCp, tst, cpSig = "x") bottomLogGrowMod.join(1, E, interiorCp, interiorCp, tst, cpSig = "x") bottomLogGrowMod.join(1, N, interiorCp, interiorInc, tst, intBit = ("0","1")) bottomLogGrowMod.join(2, N, msbInc, msbCp,tst, msbCpBit = ("*1","*0")) bottomLogGrowMod.join(1, N, msbCp, msbInc, tst, msbIncBit = ("*0","*1")) #Joins for the Inc bottomLogGrowMod.join(1, W, lsbInc, interiorInc, tst, incSig = ("n","c")) bottomLogGrowMod.join(1, W, interiorInc, interiorInc, tst, incSig = ("n","c")) bottomLogGrowMod.join(1, W, interiorInc, msbInc, tst, incSig = ("n","c")) #Joins to Transition to Port Tile Templates bottomLogGrowMod.join(2, N, msbInc, msbTrans, tst, msbCpBit = ("A*")) bottomLogGrowMod.join(1, N, interiorInc, interiorTrans, tst, intBit = "0") bottomLogGrowMod.join(1, N, lsbInc, lsbTrans, tst, lsbCpBit = "0*") bottomLogGrowMod.join(1, E, msbTrans, interiorTrans, tst, intFill = "f") bottomLogGrowMod.join(1, E, interiorTrans, interiorTrans, tst, intFill = "f") bottomLogGrowMod.join(1, E, interiorTrans, lsbTrans, tst, intFill = "f") lsbCp.addTransition(inputs=("lsbCpBit","cpSig"), outputs=("lsbIncBit"),table={("0*","x"):("0*"), ("1*","x"):("1*")}) lsbInc.addTransition(inputs=("lsbIncBit"), outputs=("lsbCpBit","incSig"), table={("1*",) : ("0*","c"), ("0*",):("1*","n")}) msbCp.addTransition(inputs=("msbCpBit"), outputs=("msbIncBit","cpSig"), table={("*1",):("*1","x"), ("*0",):("*0","x")}) msbInc.addTransition(inputs=("msbIncBit","incSig"), outputs=("msbCpBit"), table={("*1","c"):("A*"),("*0","c"):("*1"), ("*1","n"):("*1"),("*0","n"):("*0")}) interiorCp.addTransition(inputs=("cpSig","intBit"), outputs=("cpSig","intBit"),table={("x","1"):("x","1"),("x","0"):("x","0")}) interiorInc.addTransition(inputs=("intBit","incSig"), outputs=("intBit","incSig"), table={("1","c"):("0","c"),("1","n"):("1","n"),("0","c"):("1","n"),("0","n"):("0","n")}) return bottomLogGrowMod