aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbigail <abigail@abigail.be>2020-11-10 19:31:55 +0100
committerAbigail <abigail@abigail.be>2020-11-10 19:31:55 +0100
commitb3c1eec47c3ec50853165cf07960b4757653c18a (patch)
tree73b3e52caec3c0f0274ae92f8b1f9216c09325b4
parentcfbd2014a1220e88fa9cd757b77c4f68cb15c2bc (diff)
downloadperlweeklychallenge-club-b3c1eec47c3ec50853165cf07960b4757653c18a.tar.gz
perlweeklychallenge-club-b3c1eec47c3ec50853165cf07960b4757653c18a.tar.bz2
perlweeklychallenge-club-b3c1eec47c3ec50853165cf07960b4757653c18a.zip
Don't print '[ ' and ' ]' in the output.
-rw-r--r--challenge-086/abigail/perl/ch-2.pl9
-rw-r--r--challenge-086/abigail/t/output-2-1.exp18
-rw-r--r--challenge-086/abigail/t/output-2-2.exp18
-rw-r--r--challenge-086/abigail/t/output-2-3.exp18
-rw-r--r--challenge-086/abigail/t/output-2-4.exp8
5 files changed, 36 insertions, 35 deletions
diff --git a/challenge-086/abigail/perl/ch-2.pl b/challenge-086/abigail/perl/ch-2.pl
index 3ca70cf4c8..777fdac52f 100644
--- a/challenge-086/abigail/perl/ch-2.pl
+++ b/challenge-086/abigail/perl/ch-2.pl
@@ -158,11 +158,12 @@ sub solve ($solved, $unsolved) {
#
if (my $r = solve ($solved, $unsolved)) {
foreach my $x (@INDICES) {
- print "[ ";
- foreach my $y (@INDICES) {
- printf "%d ", $$r {$x, $y};
+ foreach my $i (keys @INDICES) {
+ my $y = $INDICES [$i];
+ print " " if $i;
+ print $$r {$x, $y};
}
- print "]\n";
+ print "\n";
}
}
else {
diff --git a/challenge-086/abigail/t/output-2-1.exp b/challenge-086/abigail/t/output-2-1.exp
index 6cae436d56..d56a2c8344 100644
--- a/challenge-086/abigail/t/output-2-1.exp
+++ b/challenge-086/abigail/t/output-2-1.exp
@@ -1,10 +1,10 @@
# Given example
-[ 4 3 5 2 6 9 7 8 1 ]
-[ 6 8 2 5 7 1 4 9 3 ]
-[ 1 9 7 8 3 4 5 6 2 ]
-[ 8 2 6 1 9 5 3 4 7 ]
-[ 3 7 4 6 8 2 9 1 5 ]
-[ 9 5 1 7 4 3 6 2 8 ]
-[ 5 1 9 3 2 6 8 7 4 ]
-[ 2 4 8 9 5 7 1 3 6 ]
-[ 7 6 3 4 1 8 2 5 9 ]
+4 3 5 2 6 9 7 8 1
+6 8 2 5 7 1 4 9 3
+1 9 7 8 3 4 5 6 2
+8 2 6 1 9 5 3 4 7
+3 7 4 6 8 2 9 1 5
+9 5 1 7 4 3 6 2 8
+5 1 9 3 2 6 8 7 4
+2 4 8 9 5 7 1 3 6
+7 6 3 4 1 8 2 5 9
diff --git a/challenge-086/abigail/t/output-2-2.exp b/challenge-086/abigail/t/output-2-2.exp
index ebcb02e18f..21171211bc 100644
--- a/challenge-086/abigail/t/output-2-2.exp
+++ b/challenge-086/abigail/t/output-2-2.exp
@@ -1,10 +1,10 @@
# Example Sudoku from Wikipedia
-[ 5 3 4 6 7 8 9 1 2 ]
-[ 6 7 2 1 9 5 3 4 8 ]
-[ 1 9 8 3 4 2 5 6 7 ]
-[ 8 5 9 7 6 1 4 2 3 ]
-[ 4 2 6 8 5 3 7 9 1 ]
-[ 7 1 3 9 2 4 8 5 6 ]
-[ 9 6 1 5 3 7 2 8 4 ]
-[ 2 8 7 4 1 9 6 3 5 ]
-[ 3 4 5 2 8 6 1 7 9 ]
+5 3 4 6 7 8 9 1 2
+6 7 2 1 9 5 3 4 8
+1 9 8 3 4 2 5 6 7
+8 5 9 7 6 1 4 2 3
+4 2 6 8 5 3 7 9 1
+7 1 3 9 2 4 8 5 6
+9 6 1 5 3 7 2 8 4
+2 8 7 4 1 9 6 3 5
+3 4 5 2 8 6 1 7 9
diff --git a/challenge-086/abigail/t/output-2-3.exp b/challenge-086/abigail/t/output-2-3.exp
index 0cbf14f511..f6dc83ab07 100644
--- a/challenge-086/abigail/t/output-2-3.exp
+++ b/challenge-086/abigail/t/output-2-3.exp
@@ -1,10 +1,10 @@
# 17 clue Sudoku (www.freesudoku.com)
-[ 7 3 8 4 1 2 6 5 9 ]
-[ 4 5 6 7 3 9 2 8 1 ]
-[ 1 2 9 6 8 5 7 4 3 ]
-[ 3 7 2 8 5 4 1 9 6 ]
-[ 9 1 5 3 6 7 4 2 8 ]
-[ 8 6 4 2 9 1 5 3 7 ]
-[ 2 9 1 5 7 8 3 6 4 ]
-[ 6 4 7 9 2 3 8 1 5 ]
-[ 5 8 3 1 4 6 9 7 2 ]
+7 3 8 4 1 2 6 5 9
+4 5 6 7 3 9 2 8 1
+1 2 9 6 8 5 7 4 3
+3 7 2 8 5 4 1 9 6
+9 1 5 3 6 7 4 2 8
+8 6 4 2 9 1 5 3 7
+2 9 1 5 7 8 3 6 4
+6 4 7 9 2 3 8 1 5
+5 8 3 1 4 6 9 7 2
diff --git a/challenge-086/abigail/t/output-2-4.exp b/challenge-086/abigail/t/output-2-4.exp
index bbb700ad9c..183d479b48 100644
--- a/challenge-086/abigail/t/output-2-4.exp
+++ b/challenge-086/abigail/t/output-2-4.exp
@@ -1,5 +1,5 @@
# 4x4 Sudoku
-[ 3 2 4 1 ]
-[ 4 1 3 2 ]
-[ 1 4 2 3 ]
-[ 2 3 1 4 ]
+3 2 4 1
+4 1 3 2
+1 4 2 3
+2 3 1 4