Exemplo n.º 1
0
def gen():
    fp = Convex_Hull.solve.convex_hull

    li = []

    inputs = []
    for i in range(10):
        po = 2 ** (i + 2)
        b_max = po + 10
        b_min = i*2 + 5
        inputs.append(Convex_Hull.random_dist.random_points_distribution(n = po + b_min ** 2, x_min = randint(-b_max, -(b_min)), x_max = randint(b_min, b_max), y_min = randint(-(b_max), -(b_min)), y_max = randint(b_min, b_max)))

    inputs_bis = []
    for i in inputs:
        s = str(len(i)) + "\n"
        for p in i:
            s_bis = str(p[0]) + " " + str(p[1]) + "\n"
            s += s_bis
        inputs_bis.append(s)

    i = 0
    for st in inputs_bis:
        li.append((st, run_test.get_res_test(st, fp), 1, 5 + (i / 2)))
        i+=1

    description = ""
    with open("Convex_Hull/page.html") as f:
        description = f.read()

    return (NAME_CONVEX_HULL, description, 1, li)
Exemplo n.º 2
0
def gen():
    fp = Palindrome.solve.palindrom

    li = []

    inputs = ["A Santa dog lived as a devil God at NASA",\
        "A nut for a jar of tuna",\
        "Multi tasking a future", \
        "Im going alula here", \
        "aaffaabbaaffaaggaaffaabb", \
        "A late metal has a level Multi tasking a future Lag not Eno No gong Get up Put eggnog on one-ton gal A nut for a jar of tuna", \
        "Live evil is better than alula", \
        "nop", \
        "Raising hell on eart for lion oil in a zoo", \
        "in the aaaaooaaaa what"]

    for st in inputs:
        s = st.lower()
        li.append((st, run_test.get_res_test(st, fp), 1, 1))

    description = ""
    with open("Palindrome/page.html") as f:
        description = f.read()

    return (NAME_PALINDROME, description, 0, li)
Exemplo n.º 3
0
def gen():

    fp = Hopcroft_Karp.solve.hopcroft

    li = []

    inputs = []
    for i in range(10):
        po = 2**(i + 2)
        inputs.append(gen_bipartite_graph(po, po // 2, po // 2))

    inputs_bis = []
    for i in inputs:
        s = str(len(i)) + "\n"
        for p in i:
            s_bis = str(p[0]) + " " + str(p[1]) + "\n"
            s += s_bis
        inputs_bis.append(s)

    i = 0
    for st in inputs_bis:
        li.append((st, run_test.get_res_test(st, fp), 1, 5 + (i / 2)))
        i += 1

    description = ""
    with open("Hopcroft_Karp/page.html") as f:
        description = f.read()

    return (NAME_HOPCROFT_KARP, description, 1, li)
Exemplo n.º 4
0
def gen():
    fp = Mediane.solve.mediane

    inputs = [
        create(10),
        create(10),
        create(10),
        create(50),
        create(50),
        create(100),
        create(100),
        create(10000),
        create(10000),
        create(100000)
    ]

    li = []

    for st in inputs:
        li.append((st, run_test.get_res_test(st, fp), 1, 1))

    description = ""
    with open("Mediane/page.html") as f:
        description = f.read()

    return (NAME_MEDIANE, description, 0, li)
Exemplo n.º 5
0
def gen():
    fp = Hello.solve.hello

    li = []

    inputs = ["ip7", "Einstein", "Tobi", "World"]

    for st in inputs:
        li.append((st, run_test.get_res_test(st, fp), 1, 1))

    description = ""
    with open("Hello/page.html") as f:
        description = f.read()

    return (NAME_HELLO, description, 0, li)
Exemplo n.º 6
0
def gen():
    fp = Polygons.solve.polygons

    li = []

    inputs = []
    # inputs stolen from the SWERC problem
    for i in range(1, NUMBER_OF_TESTS + 1):
        with open("Polygons/test{}.in".format(i)) as f:
            inputs.append(f.read())

    for st in inputs:
        li.append((st, run_test.get_res_test(st, fp), 1, 1))

    description = ""
    with open("Polygons/page.html") as f:
        description = f.read()

    return (NAME_POLYGON, description, 0, li)
Exemplo n.º 7
0
def gen():

    fp = Rect.solve.rect_from_input

    li = []

    inputs = []
    for i in range(10):
        po = 2**(i + 1)
        inputs.append(random_area(po, randint(po // 2, po),
                                  random() / 5 + 0.1))

    for st in inputs:
        li.append((st, run_test.get_res_test(st, fp), 1, 1))

    description = ""
    with open("Rect/page.html") as f:
        description = f.read()

    return (NAME_RECT, description, 0, li)
Exemplo n.º 8
0
def gen():
    fp = RainbowRider.solve.rainbow

    li = []

    inputs = [
        "3 2\n4 3\n1 5\n3 5\n", "3 4\n1 2\n2 3\n3 4\n", "3 1\n2 3\n1 5\n7 2\n"
    ]

    for i in range(1, 8):
        with open("RainbowRider/test{}.in".format(i)) as f:
            inputs.append(f.read())

    for st in inputs:
        li.append((st, run_test.get_res_test(st, fp), 1, 1))

    description = ""
    with open("RainbowRider/page.html") as f:
        description = f.read()

    return (NAME_RAINBOW, description, 0, li)
Exemplo n.º 9
0
def gen():
    fp = Cycle.solve.cycle

    li = []

    inputs = [
        "1 1 1 1 3\n", "1 2 3 2 4\n", "1165 2569 13 3 13\n",
        "13812 12642 10 2 14\n", "20057 21554 15 8 15\n",
        "7265 46726 16 6 16\n", "30545 112741 3 16 18\n",
        "238767 45165 4 4 19\n", "95483 320692 13 18 20\n",
        "499452 440880 11 5 20\n", "198098 2074428 3 2 21\n", "13 2 5 7 22\n"
    ]

    for st in inputs:
        li.append((st, run_test.get_res_test(st, fp), 1, 1))

    description = ""
    with open("Cycle/page.html") as f:
        description = f.read()

    return (NAME_CYCLE, description, 0, li)
Exemplo n.º 10
0
def gen():
    fp = Words.solve.words

    li = []

    words = ["krakus", "alar", "tobi", "azimov", "arkane", "tolkien", "lovecraft", "valar",
              "morgoth", "erlie", "zappatta", "mozart", "zimbabwe", "epiphanie", "youpi",
              "erzok", "martin", "antigone"]

    inputs = []

    for i in range(0,10):
        inputs.append(' '.join(gen_text(words)))

    for st in inputs:
        li.append((st, run_test.get_res_test(st, fp), 1, 1))

    description = ""
    with open("Words/page.html") as f:
        description = f.read()

    return (NAME_WORDS, description, 0, li)
Exemplo n.º 11
0
def gen():
    fp = Roads.solve.roads

    li = []

    inputs = [small_example]
    for _ in range(5):
        inputs.append(gen_input(1000, 100))
    for _ in range(5):
        inputs.append(gen_input(MAX_N, MAX_Q))
    inputs.append(gen_line(MAX_N, MAX_Q))

    i = 0
    for st in inputs:
        li.append((st, run_test.get_res_test(st, fp), 1, 10 + i))
        i += 1

    description = ""
    with open("Roads/page.html") as f:
        description = f.read()

    return (NAME_ROADS, description, 2, li)
Exemplo n.º 12
0
def gen():
    fp = LesserPath.solve.lesser

    li = []

    inputs = [
        "7 9\n0 6\n0 1 1\n0 2 1\n0 3 2\n0 4 3\n1 5 2\n2 6 4\n3 6 2\n4 6 4\n5 6 1\n",
        "4 6\n0 2\n0 1 1\n1 2 1\n1 3 1\n3 2 1\n2 0 3\n3 0 2\n"
    ]

    for i in range(0, 9):
        with open("LesserPath/test{}".format(i)) as f:
            inputs.append(f.read())

    i = 0
    for st in inputs:
        li.append((st, run_test.get_res_test(st, fp), 1, 10 + i))
        i += 1

    description = ""
    with open("LesserPath/page.html") as f:
        description = f.read()

    return (NAME_LESSER, description, 2, li)