3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-12-26 12:42:49 +01:00

Spinach: bugfix ja_convert.pl

This commit is contained in:
Pragmatic Software 2019-05-07 12:51:21 -07:00
parent a0359c27dd
commit efed5c3715

View File

@ -12,10 +12,9 @@ my $questions = { questions => [] };
my $debug = 0;
my $kill_id = 9999999;
#my $kill_id = 10;
#$kill_id = 10;
my @files = glob '*game*.html';
#my @files = glob '*game-1022.html';
my $id = 0;
@ -131,12 +130,14 @@ foreach my $file (@files) {
$question =~ s/^\s+|\s+$//g;
$answer =~ s/^\s+|\s+$//g;
if ($clue_value =~ m/\$(\d+,?\d+)/) {
if ($clue_value =~ m/(\d+,?\d+)$/) {
$clue_value = $1;
} elsif ($clue_value =~ m/^(\d+)$/) {
} elsif ($clue_value =~ m/(\d+)$/) {
$clue_value = $1;
}
$clue_value =~ s/,//g;
if (not $clue_value) {
print "Bad clue value.\n";
die;
@ -151,6 +152,10 @@ foreach my $file (@files) {
print "Has alternates: [$answer] ", join (', ', @alternates), "\n";
}
# "numify" values for JSON
$id += 0;
$clue_value += 0;
my $new_question = {
alternativeSpellings => \@alternates,
suggestions => [],