<commit_before>import os

import cellular
import util

def get_classification():
    answer = None

    while answer not in ('1', '2', '3', '4'):
        answer = input("Class: ")

    return answer


def main():
    cas_folder = 'cas/'

    try:
        os.mkdir(cas_folder)
    except FileExistsError:
        pass

    colors = ['black', 'blue', 'yellow', 'orange', 'red']

    ca = cellular.TotalisticCellularAutomaton(400, colors=colors)

    base = str(ca)

    while any(rule != 0 for rule in ca.rules):
        ca.reseed()
        ca.run(800)
        ca.print_stats()

        image = ca.draw()
        image.show()

        classification = get_classification()

        image.save(cas_folder + '{}-{}-{}.png'.format(base, ca, classification))
        ca.decimate()<commit_msg>Restructure classification loop<commit_after>import os

import cellular
import util


def main():
    cas_folder = 'tmp/'

    try:
        os.mkdir(cas_folder)
    except FileExistsError:
        pass

    colors = ['black', 'blue', 'yellow', 'orange', 'red']

    ca = cellular.TotalisticCellularAutomaton(400, colors=colors, radius=1, states=5)

    base = str(ca)

    while any(rule != 0 for rule in ca.rules):
        ca.reseed()
        ca.run(800)
        ca.print_stats()

        image = ca.draw()
        image.show()


        while True:
            answer = input("Class: ")
            if answer in ('1', '2', '3', '4'):
                break
            else:
                ca.resume(800)
                image = ca.draw()
                image.show()

        image.save(cas_folder + '{}-{}-{}.png'.format(base, ca, answer))
        ca.decimate()
{'fraction_non_alphanumeric': 0.14233797698364628, 'fraction_numerical': 0.01635372501514234, 'mean_word_length': 2.047970479704797, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6654640', 'n_tokens_mistral': 547, 'n_tokens_neox': 495, 'n_words': 126}