Exemplo n.º 1
0
def halfBorders22(outs=1):
    start = board.Board(3, 3)    
    
    t = board.Board(3, 3, [0, 1, 1, 
                           1, 1, 1, 
                           1, 1, 1 ])
    
    a = [4, 5, 7, 8]
    ways = waysCompB(start, t, outs, None, a)
    
    lengthTab = []
    nblogTab = []

    for i, b in enumerate(board.validWithHalfBorders(2, 2)):
        if i >=0 :
            b.prt()
            l, nb = ways.possibleWays(b, 0)
            nb_log= log10(nb)
    
            print("        %s"%(i))
            print("           fill longest: %s   numbers: %s  log: %s"%(l, nb, nb_log))        
    
            b_l, b_nb = ways.possibleWaysBack(b.getPos(), 0)
            b_nb_log=log10(b_nb)

            print("         build  longest: %s   numbers: %s  log: %s"%(b_l, b_nb, b_nb_log))        
            print("         total  longest: %s   numbers: %s  log: %s"%(l+b_l, nb * b_nb, nb_log + b_nb_log))        

            lengthTab.append(l + b_l)
            nblogTab.append(nb_log + b_nb_log)
    
    print('\n\n')
    print("Total   length: %s    nb=10^%s"%(sum(lengthTab), sum(nblogTab)))
Exemplo n.º 2
0
def halfBorders42build():
    start = board.Board(5, 3)
    a2 = [6, 7, 8, 9, 11, 12, 13, 14]

    lengthTab = []
    nblogTab = []

    for i, b in enumerate(board.validWithHalfBorders(4, 2)):
        b.prt()
        ways = waysComp(b, m2=a2)       
        l, nb = ways.possibleWays(start, 1)
        nb_log= log10(nb)

        print("        %s longest: %s   numbers: %s  log: %s"%(i, l, nb, nb_log))        
        lengthTab.append(l)
        nblogTab.append(nb_log)

    print('\n\n')
    print("Total   length: %s    nb=10^%s"%(sum(lengthTab), sum(nblogTab)))
Exemplo n.º 3
0
def halfBorders42build():
    start = board.Board(5, 3)
    a2 = [6, 7, 8, 9, 11, 12, 13, 14]

    lengthTab = []
    nblogTab = []

    for i, b in enumerate(board.validWithHalfBorders(4, 2)):
        b.prt()
        ways = waysComp(b, m2=a2)
        l, nb = ways.possibleWays(start, 1)
        nb_log = log10(nb)

        print("        %s longest: %s   numbers: %s  log: %s" %
              (i, l, nb, nb_log))
        lengthTab.append(l)
        nblogTab.append(nb_log)

    print('\n\n')
    print("Total   length: %s    nb=10^%s" % (sum(lengthTab), sum(nblogTab)))
Exemplo n.º 4
0
def halfBorders42Fillwith1():
    t = board.Board(5, 3, [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])

    a = [6, 7, 8, 9, 11, 12, 13, 14]
    ways = waysComp(t, a, a)

    lengthTab = []
    nblogTab = []

    for i, b in enumerate(board.validWithHalfBorders(4, 2)):
        b.prt()
        l, nb = ways.possibleWays(b, 0)
        nb_log = log10(nb)

        print("        %s longest: %s   numbers: %s  log: %s" %
              (i, l, nb, nb_log))

        lengthTab.append(l)
        nblogTab.append(nb_log)

    print('\n\n')
    print("Total   length: %s    nb=10^%s" % (sum(lengthTab), sum(nblogTab)))
Exemplo n.º 5
0
def halfBorders42Fillwith1():
    t = board.Board(5, 3, [0, 1, 1, 1, 1,
                           1, 1, 1, 1, 1,
                           1, 1, 1, 1, 1])
    
    a = [6, 7, 8, 9, 11, 12, 13, 14]
    ways = waysComp(t, a, a)
    
    lengthTab = []
    nblogTab = []

    for i, b in enumerate(board.validWithHalfBorders(4, 2)):
        b.prt()
        l, nb = ways.possibleWays(b, 0)
        nb_log= log10(nb)

        print("        %s longest: %s   numbers: %s  log: %s"%(i, l, nb, nb_log))        

        lengthTab.append(l)
        nblogTab.append(nb_log)
    
    print('\n\n')
    print("Total   length: %s    nb=10^%s"%(sum(lengthTab), sum(nblogTab)))
Exemplo n.º 6
0
def p42():
    for i, b in enumerate(board.validWithHalfBorders(4, 2)):
        b.prt()
        print("            %s"%(i,))
Exemplo n.º 7
0
def p42():
    for i, b in enumerate(board.validWithHalfBorders(4, 2)):
        b.prt()
        print("            %s" % (i, ))