Shlomi Fish committed 93ed558

Add the scripts.

This is a range solving based on GNU parallel.

  • Participants
  • Parent commits dac9107

Comments (0)

Files changed (5)

File black-hole-solitaire/all-in-a-row-gnu-parallel-range-solving/prepare.bash


File black-hole-solitaire/all-in-a-row-gnu-parallel-range-solving/range-solving.bash

+source 'prepare.bash'
+# Configuration
+seq "${start_idx//,/}" "${end_idx//,/}" | parallel -j"$num_cpus" perl {}

File black-hole-solitaire/all-in-a-row-gnu-parallel-range-solving/summaries/PLACEHOLDER

Empty file added.

File black-hole-solitaire/all-in-a-row-gnu-parallel-range-solving/

+use strict;
+use warnings;
+use autodie;
+use List::Util qw(first);
+my $board_idx = shift(@ARGV);
+my $text= ` -F -t $board_idx all_in_a_row | all-in-a-row-solve`;
+my ($verdict, $checked, $gen) = ($text =~ m{(Solved|Unsolved).*?^Total number of states checked is (\d+)\..*?^This scan generated (\d+) states\.}ms);
+my $v = substr($verdict, 0, 1);
+# We are using a temporary place and moving so it will be atomic.
+my $basename = "$board_idx.summary";
+my $temp_fn = "temp-summaries/$basename";
+open my $out_fh, '>', $temp_fn;
+print {$out_fh} "$board_idx\t$v\t$checked\t$gen\n";
+close ($out_fh);
+rename ($temp_fn, "summaries/$basename");

File black-hole-solitaire/all-in-a-row-gnu-parallel-range-solving/temp-summaries/PLACEHOLDER

Empty file added.