Example #1
0
# initializing variables
start = time.time()
files = os.listdir(
    os.path.join(os.path.dirname(os.path.realpath(__file__)), "solutions"))
winners = []
wrong = []
forbidden = ["__init__.py"]
disqualified = []
for i in forbidden:
    if i in files:
        files.remove(i)

try:
    # generating test cases and assigning the correct answers
    checks = testcases.gen(10000)
    print()
    outs = []
    for check in checks:
        test = copy.deepcopy(check)
        outs.append(solution(*test))

    # testing
    for index, f in enumerate(files):
        if f.endswith(".py"):
            scann = scan(
                os.path.join(os.path.dirname(os.path.realpath(__file__)),
                             "solutions", f))
            if not scann[0]:
                wrong.append(f"\n{f.split('.')[0]}\nnot allowed: {scann[1]}")
                continue
Example #2
0
from testcases import gen
import json
from check import solution

array = gen(3000000)
cases = [array, []]

for case in cases[0]:
    cases[1].append(solution(case))

with open("tests.json", 'w') as f:
    json.dump(cases, f)
Example #3
0
import os, random, json, testcases, time
from Alex import validate
import update_board
from pathlib import Path
start = time.time()
files = os.listdir(os.path.dirname(os.path.realpath(__file__)))
passs = 0
no_pass = 0
peeps = []

checks = testcases.gen()
tests = {}
for check in checks:
    tests[check] = validate(check)

keys = tests.keys()

wrong = []

for f in files:
    if f.endswith(".py") and f != os.path.basename(__file__):
        if f != "testcases.py" and f != "Alex.py":
            unit = __import__(f"{f.split('.')[0]}")
            passed = True
            count = 0
            for i in keys:
                if count < 1:
                    try:
                        if unit.validate(i) != tests[i]:
                            passed = False
                            wrong.append(
Example #4
0
# initializing variables
start = time.time()
files = os.listdir(
    os.path.join(os.path.dirname(os.path.realpath(__file__)), "solutions"))
winners = []
wrong = []
forbidden = ["__init__.py"]
disqualified = []
for i in forbidden:
    if i in files:
        files.remove(i)

try:
    # generating test cases and assigning the correct answers
    checks = testcases.gen(4000)
    print()
    outs = []
    for check in checks:
        test = copy.deepcopy(check)
        outs.append(solution(test))

    # testing
    for index, f in enumerate(files):
        if f.endswith(".py"):
            if f in disqualified:
                wrong.append(
                    f"\n{f.split('.')[0]}\ndisqualified for disrespecting/disobeying staff or breaking the rules"
                )
                continue
            starteff = time.time()
Example #5
0
from testcases import gen
import json


def solution(a):
    if len(a) > 10:
        return False
    return a.count('n') == a.count('s') and a.count('e') == a.count('w')


array = gen(2000)
cases = [array, []]

for case in cases[0]:
    cases[1].append(solution(case))

with open("tests.json", 'w') as f:
    json.dump(cases, f)
Example #6
0
# initializing variables
start = time.time()
files = os.listdir(
    os.path.join(os.path.dirname(os.path.realpath(__file__)), "solutions"))
winners = []
wrong = []
forbidden = ["__init__.py"]
disqualified = []
slow = ['COMEBACK']
for i in forbidden:
    if i in files:
        files.remove(i)

try:
    # generating test cases and assigning the correct answers
    checks = testcases.gen(19999)
    print()
    outs = []
    for check in checks:
        test = copy.deepcopy(check)
        outs.append(solution(*test))

    # testing
    for index, f in enumerate(files):
        if f.endswith(".py"):
            if f in disqualified:
                wrong.append(
                    f"\n{f.split('.')[0]}\ndisqualified for disrespecting/disobeying staff or breaking the rules"
                )
                continue
            starteff = time.time()