<commit_before>#!/usr/bin/perl

use strict;
use warnings;
use autodie;

my $N = shift || 20;
my $M = $N * $N;

while( <> ) {
    last if /satisfiable/i;
}
if( /unsatisfiable/i ) {
    print "NA\n";
    exit;
}

my( @F );
my $s = join " ", <>;
$s =~ s/(-?\d+)/process($1)/egs;

print join ",", @F[1..$M];
print "\n";

sub process {
    my( $x ) = @_;
    set( decode($x), $x > 0 );
}

sub set {
    my( $i, $k ) = @_;
    $F[$i] = 0+$k;
}

sub decode {
    my( $x ) = @_;
    return abs($x);
}
<commit_msg>Use library function to pretty-print grid.<commit_after>#!/usr/bin/perl

use strict;
use warnings;
use autodie;

use File::Basename;
use lib dirname (__FILE__);
use ReverseLife qw(display_grid);

my $N = shift || 20;
my $M = $N * $N;

while( <> ) {
    last if /satisfiable/i;
}
if( /unsatisfiable/i ) {
    print "NA\n";
    exit;
}

my( @F );
my $s = join " ", <>;
$s =~ s/(-?\d+)/process($1)/egs;

shift @F;
print display_grid(flat => \@F);

sub process {
    my( $x ) = @_;
    set( decode($x), $x > 0 );
}

sub set {
    my( $i, $k ) = @_;
    $F[$i] = 0+$k;
}

sub decode {
    my( $x ) = @_;
    return abs($x);
}

{'fraction_non_alphanumeric': 0.238898756660746, 'fraction_numerical': 0.009769094138543518, 'mean_word_length': 2.5, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 10, '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': '4637054', 'n_tokens_mistral': 529, 'n_tokens_neox': 510, 'n_words': 128}