<commit_before><?php

namespace igorw\turing;

function graphviz_rules(array $rules, array $accept_states)
{
    $template = <<<EOF
digraph finite_state_machine {
    rankdir=LR;
%s
}

EOF;

    $out = '';

    if ($accept_states) {
        $out .= sprintf("    node [shape = doublecircle]; %s;\n", implode(' ', $accept_states));
    }

    $out .= "    node [shape = circle];\n";

    foreach ($rules as $rule) {
        list($init_state, $read_cond, $write_val, $move_dir, $new_state) = $rule;

        $move_dir = strtoupper($move_dir);

        $out .= "    $init_state -> $new_state [ label = \"$read_cond, $write_val, $move_dir\" ];\n";
    }

    return sprintf($template, $out);
}
<commit_msg>rename finite_state_machine to turing_machine<commit_after><?php

namespace igorw\turing;

function graphviz_rules(array $rules, array $accept_states)
{
    $template = <<<EOF
digraph turing_machine {
    rankdir=LR;
%s
}

EOF;

    $out = '';

    if ($accept_states) {
        $out .= sprintf("    node [shape = doublecircle]; %s;\n", implode(' ', $accept_states));
    }

    $out .= "    node [shape = circle];\n";

    foreach ($rules as $rule) {
        list($init_state, $read_cond, $write_val, $move_dir, $new_state) = $rule;

        $move_dir = strtoupper($move_dir);

        $out .= "    $init_state -> $new_state [ label = \"$read_cond, $write_val, $move_dir\" ];\n";
    }

    return sprintf($template, $out);
}

{'fraction_non_alphanumeric': 0.17366946778711484, 'fraction_numerical': 0.0, 'mean_word_length': 3.059659090909091, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 5, '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': '5898797', 'n_tokens_mistral': 524, 'n_tokens_neox': 514, 'n_words': 109}