aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-062/luca-ferrari/raku/ch-2.p67
1 files changed, 5 insertions, 2 deletions
diff --git a/challenge-062/luca-ferrari/raku/ch-2.p6 b/challenge-062/luca-ferrari/raku/ch-2.p6
index 7679e57f2c..c56a20c4ff 100644
--- a/challenge-062/luca-ferrari/raku/ch-2.p6
+++ b/challenge-062/luca-ferrari/raku/ch-2.p6
@@ -3,6 +3,8 @@
# Task 2
# N-queens
+# Places the queen into the chessboard at the indicated coordinates.
+# Also setto False every square the queen can reach.
sub place-queen( @chessboard, $row, $column, $height, $dimension ){
for 0 ..^ $dimension {
@@ -23,7 +25,9 @@ sub place-queen( @chessboard, $row, $column, $height, $dimension ){
}
-
+#
+# Show every level of the chessboard.
+#
sub show-chessboard( @chessboard, $dimension ) {
for 0 ..^ $dimension -> $height {
say "Layer $height";
@@ -43,7 +47,6 @@ sub show-chessboard( @chessboard, $dimension ) {
}
sub MAIN( Int $dimension = 3 ){
- my $val = True;
my @chessboard = [[True xx $dimension] xx $dimension] xx $dimension;
for 0 ..^ $dimension -> $height {