<commit_before># Copyright (C) 2015 <NAME> <<EMAIL>>
#
# This script is published under the terms of the MIT license.
# See http://opensource.org/licenses/mit-license.php

# Python 3 is required


from datetime import datetime

from sudoku import Sudoku


# Copyright <NAME>
# AI sudoku top 10 set 1
array = [
    # AI escargot
    """1 0 0 0 0 7 0 9 0
       0 3 0 0 2 0 0 0 8
       0 0 9 6 0 0 5 0 0
       0 0 5 3 0 0 9 0 0
       0 1 0 0 8 0 0 0 2
       6 0 0 0 0 4 0 0 0
       3 0 0 0 0 0 0 1 0
       0 4 0 0 0 0 0 0 7
       0 0 7 0 0 0 3 0 0""",
    # AI killer application
    """0 0 0 0 0 0 0 7 0
       0 6 0 0 1 0 0 0 4
       0 0 3 4 0 0 2 0 0
       8 0 0 0 0 3 0 5 0
       0 0 2 9 0 0 7 0 0
       0 4 0 0 8 0 0 0 9
       0 2 0 0 6 0 0 0 7
       0 0 0 1 0 0 9 0 0
       7 0 0 0 0 8 0 6 0""",
    # AI lucky diamond
    """1 0 0 5 0 0 4 0 0
       0 0 9 0 3 0 0 0 0
       0 7 0 0 0 8 0 0 5
       0 0 1 0 0 0 0 3 0
       8 0 0 6 0 0 5 0 0
       0 9 0 0 0 7 0 0 8
       0 0 4 0 2 0 0 1 0
       2 0 0 8 0 0 6 0 0
       0 0 0 0 0 1 0 0 2""",
    # AI worm hole
    """0 8 0 0 0 0 0 0 1
       0 0 7 0 0 4 0 2 0
       6 0 0 3 0 0 7 0 0
       0 0 2 0 0 9 0 0 0
       1 0 0 0 6 0 0 0 8
       0 3 0 4 0 0 0 0 0
       0 0 1 7 0 0 6 0 0
       0 9 0 0 0 8 0 0 5
       0 0 0 0 0 0 0 4 0""",
    # AI labyrinth
    """1 0 0 4 0 0 8 0 0
       0 4 0 0 3 0 0 0 9
       0 0 9 0 0 6 0 5 0
       0 5 0 3 0 0 0 0 0
       0 0 0 0 0 1 6 0 0
       0 0 0 0 7 0 0 0 2
       0 0 4 0 1 0 9 0 0
       7 0 0 8 0 0 0 0 4
       0 2 0 0 0 4 0 8 0""",
    # AI circles
    """0 0 5 0 0 9 7 0 0
       0 6 0 0 0 0 0 2 0
       1 0 0 8 0 0 0 0 6
       0 1 0 7 0 0 0 0 4
       0 0 7 0 6 0 0 3 0
       6 0 0 0 0 3 2 0 0
       0 0 0 0 0 6 0 4 0
       0 9 0 0 5 0 1 0 0
       8 0 0 1 0 0 0 0 2""",
    # AI squadron
    """6 0 0 0 0 0 2 0 0
       0 9 0 0 0 1 0 0 5
       0 0 8 0 3 0 0 4 0
       0 0 0 0 0 2 0 0 1
       5 0 0 6 0 0 9 0 0
       0 0 7 0 9 0 0 0 0
       0 7 0 0 0 3 0 0 2
       0 0 0 4 0 0 5 0 0
       0 0 6 0 7 0 0 8 0""",
    # AI honeypot
    """1 0 0 0 0 0 0 6 0
       0 0 0 1 0 0 0 0 3
       0 0 5 0 0 2 9 0 0
       0 0 9 0 0 1 0 0 0
       7 0 0 0 4 0 0 8 0
       0 3 0 5 0 0 0 0 2
       5 0 0 4 0 0 0 0 6
       0 0 8 0 6 0 0 7 0
       0 7 0 0 0 5 0 0 0""",
    # AI tweezers
    """0 0 0 0 1 0 0 0 4
       0 3 0 2 0 0 0 0 0
       6 0 0 0 0 8 0 9 0
       0 0 7 0 6 0 0 0 5
       9 0 0 0 0 5 0 8 0
       0 0 0 8 0 0 4 0 0
       0 4 0 9 0 0 1 0 0
       7 0 0 0 0 2 0 4 0
       0 0 5 0 3 0 0 0 7""",
    # AI broken brick
    """4 0 0 0 6 0 0 7 0
       0 0 0 0 0 0 6 0 0
       0 3 0 0 0 2 0 0 1
       7 0 0 0 0 8 5 0 0
       0 1 0 4 0 0 0 0 0
       0 2 0 9 5 0 0 0 0
       0 0 0 0 0 0 7 0 5
       0 0 9 1 0 0 0 3 0
       0 0 3 0 4 0 0 8 0""",
    # Empty test
    """0 0 0 0 0 0 0 0 0
       0 0 0 0 0 0 0 0 0
       0 0 0 0 0 0 0 0 0
       0 0 0 0 0 0 0 0 0
       0 0 0 0 0 0 0 0 0
       0 0 0 0 0 0 0 0 0
       0 0 0 0 0 0 0 0 0
       0 0 0 0 0 0 0 0 0
       0 0 0 0 0 0 0 0 0""",
]

n = 100
s = 0
for j in range(n):
    now = datetime.now()
    for i in array:
        sudoku = Sudoku(i)
        solved = sudoku.solve()
        if not solved and not j:
            print("Failed to solve: \n%s" % '\n'.join([row.strip() for row in i.split('\n')]))
    delta = (datetime.now() - now).total_seconds()
    s += delta
print('Elapsed real time %fs.' % s)
print('Average real time %fs.' % (s / n))<commit_msg>tests.py: Print the amount of fails<commit_after># Copyright (C) 2015 <NAME> <<EMAIL>>
#
# This script is published under the terms of the MIT license.
# See http://opensource.org/licenses/mit-license.php

# Python 3 is required


from datetime import datetime

from sudoku import Sudoku


# Copyright <NAME>
# AI sudoku top 10 set 1
array = [
    # AI escargot
    """1 0 0 0 0 7 0 9 0
       0 3 0 0 2 0 0 0 8
       0 0 9 6 0 0 5 0 0
       0 0 5 3 0 0 9 0 0
       0 1 0 0 8 0 0 0 2
       6 0 0 0 0 4 0 0 0
       3 0 0 0 0 0 0 1 0
       0 4 0 0 0 0 0 0 7
       0 0 7 0 0 0 3 0 0""",
    # AI killer application
    """0 0 0 0 0 0 0 7 0
       0 6 0 0 1 0 0 0 4
       0 0 3 4 0 0 2 0 0
       8 0 0 0 0 3 0 5 0
       0 0 2 9 0 0 7 0 0
       0 4 0 0 8 0 0 0 9
       0 2 0 0 6 0 0 0 7
       0 0 0 1 0 0 9 0 0
       7 0 0 0 0 8 0 6 0""",
    # AI lucky diamond
    """1 0 0 5 0 0 4 0 0
       0 0 9 0 3 0 0 0 0
       0 7 0 0 0 8 0 0 5
       0 0 1 0 0 0 0 3 0
       8 0 0 6 0 0 5 0 0
       0 9 0 0 0 7 0 0 8
       0 0 4 0 2 0 0 1 0
       2 0 0 8 0 0 6 0 0
       0 0 0 0 0 1 0 0 2""",
    # AI worm hole
    """0 8 0 0 0 0 0 0 1
       0 0 7 0 0 4 0 2 0
       6 0 0 3 0 0 7 0 0
       0 0 2 0 0 9 0 0 0
       1 0 0 0 6 0 0 0 8
       0 3 0 4 0 0 0 0 0
       0 0 1 7 0 0 6 0 0
       0 9 0 0 0 8 0 0 5
       0 0 0 0 0 0 0 4 0""",
    # AI labyrinth
    """1 0 0 4 0 0 8 0 0
       0 4 0 0 3 0 0 0 9
       0 0 9 0 0 6 0 5 0
       0 5 0 3 0 0 0 0 0
       0 0 0 0 0 1 6 0 0
       0 0 0 0 7 0 0 0 2
       0 0 4 0 1 0 9 0 0
       7 0 0 8 0 0 0 0 4
       0 2 0 0 0 4 0 8 0""",
    # AI circles
    """0 0 5 0 0 9 7 0 0
       0 6 0 0 0 0 0 2 0
       1 0 0 8 0 0 0 0 6
       0 1 0 7 0 0 0 0 4
       0 0 7 0 6 0 0 3 0
       6 0 0 0 0 3 2 0 0
       0 0 0 0 0 6 0 4 0
       0 9 0 0 5 0 1 0 0
       8 0 0 1 0 0 0 0 2""",
    # AI squadron
    """6 0 0 0 0 0 2 0 0
       0 9 0 0 0 1 0 0 5
       0 0 8 0 3 0 0 4 0
       0 0 0 0 0 2 0 0 1
       5 0 0 6 0 0 9 0 0
       0 0 7 0 9 0 0 0 0
       0 7 0 0 0 3 0 0 2
       0 0 0 4 0 0 5 0 0
       0 0 6 0 7 0 0 8 0""",
    # AI honeypot
    """1 0 0 0 0 0 0 6 0
       0 0 0 1 0 0 0 0 3
       0 0 5 0 0 2 9 0 0
       0 0 9 0 0 1 0 0 0
       7 0 0 0 4 0 0 8 0
       0 3 0 5 0 0 0 0 2
       5 0 0 4 0 0 0 0 6
       0 0 8 0 6 0 0 7 0
       0 7 0 0 0 5 0 0 0""",
    # AI tweezers
    """0 0 0 0 1 0 0 0 4
       0 3 0 2 0 0 0 0 0
       6 0 0 0 0 8 0 9 0
       0 0 7 0 6 0 0 0 5
       9 0 0 0 0 5 0 8 0
       0 0 0 8 0 0 4 0 0
       0 4 0 9 0 0 1 0 0
       7 0 0 0 0 2 0 4 0
       0 0 5 0 3 0 0 0 7""",
    # AI broken brick
    """4 0 0 0 6 0 0 7 0
       0 0 0 0 0 0 6 0 0
       0 3 0 0 0 2 0 0 1
       7 0 0 0 0 8 5 0 0
       0 1 0 4 0 0 0 0 0
       0 2 0 9 5 0 0 0 0
       0 0 0 0 0 0 7 0 5
       0 0 9 1 0 0 0 3 0
       0 0 3 0 4 0 0 8 0""",
    # Empty test
    """0 0 0 0 0 0 0 0 0
       0 0 0 0 0 0 0 0 0
       0 0 0 0 0 0 0 0 0
       0 0 0 0 0 0 0 0 0
       0 0 0 0 0 0 0 0 0
       0 0 0 0 0 0 0 0 0
       0 0 0 0 0 0 0 0 0
       0 0 0 0 0 0 0 0 0
       0 0 0 0 0 0 0 0 0""",
]

n = 100
s = 0
f = 0
for j in range(n):
    now = datetime.now()
    for i in array:
        sudoku = Sudoku(i)
        solved = sudoku.solve()
        if not solved and not j:
            f += 1
            print("Failed to solve: \n%s" % '\n'.join([row.strip() for row in i.split('\n')]))
    delta = (datetime.now() - now).total_seconds()
    s += delta
print('Elapsed real time %fs.' % s)
print('Average real time %fs.' % (s / n))
print('Failed %d of %d sudoku-s.' % (f, len(array)))
{'fraction_non_alphanumeric': 0.05726058539357772, 'fraction_numerical': 0.25689116226200626, 'mean_word_length': 0.9132916553411253, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 176, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '430664', 'n_tokens_mistral': 4520, 'n_tokens_neox': 2906, 'n_words': 2027}