From f6a8d5af7bb92ef0d021fe409b466c9ed25bb0dd Mon Sep 17 00:00:00 2001 From: Abigail Date: Mon, 21 Jun 2021 12:42:22 +0200 Subject: README for week 118 --- challenge-118/abigail/README.md | 88 +++++++++++++++++------------------------ 1 file changed, 37 insertions(+), 51 deletions(-) diff --git a/challenge-118/abigail/README.md b/challenge-118/abigail/README.md index 7db94b7f39..05677d379c 100644 --- a/challenge-118/abigail/README.md +++ b/challenge-118/abigail/README.md @@ -1,27 +1,20 @@ # Solutions by Abigail -## [Missing Row](https://perlweeklychallenge.org/blog/perl-weekly-challenge-117/#TASK1) +## [Binary Palindrome](https://perlweeklychallenge.org/blog/perl-weekly-challenge-118/#TASK1) -> You are given text file with rows numbered `1-15` in random order but -> there is a catch one row in missing in the file. +> You are given a positive integer $N. +> +> Write a script to find out if the binary representation of the given +> integer is Palindrome. Print 1 if it is otherwise 0. +> +### Examples ~~~~ -11, Line Eleven -1, Line one -9, Line Nine -13, Line Thirteen -2, Line two -6, Line Six -8, Line Eight -10, Line Ten -7, Line Seven -4, Line Four -14, Line Fourteen -3, Line three -15, Line Fifteen -5, Line Five -~~~~ +Input: $N = 5 +Output: 1 as binary representation of 5 is 101 which is Palindrome. -Write a script to find the missing row number. +Input: $N = 4 +Output: 0 as binary representation of 4 is 100 which is NOT Palindrome. +~~~~ ### Solutions * [AWK](awk/ch-1.awk) @@ -36,41 +29,34 @@ Write a script to find the missing row number. * [Ruby](ruby/ch-1.rb) ### Blog -[Missing Row](https://abigail.github.io/HTML/Perl-Weekly-Challenge/week-117-1.html) +[Binary Palindrome](https://abigail.github.io/HTML/Perl-Weekly-Challenge/week-118-1.html) -## [Find Possible Paths](https://perlweeklychallenge.org/blog/perl-weekly-challenge-115/#TASK2) +## [Adventure of Knight](https://perlweeklychallenge.org/blog/perl-weekly-challenge-118/#TASK2) -> You are given size of a triangle. -> -> Write a script to find all possible paths from top to the bottom -> right corner. -> -> In each step, we can either move horizontally to the right (`H`), or -> move downwards to the left (`L`) or right (`R`). +> A knight is restricted to move on an 8x8 chessboard. The knight is denoted +> by `N` and its way of movement is the same as what it is defined in Chess. +> `*` represents an empty square. `x` represents a square with treasure. +> +> > The Knight's movement is unique. It may move two squares vertically and +> > one square horizontally, or two squares horizontally and one square +> > vertically (with both forming the shape of an L). +> +> There are 6 squares with treasures. +> +> Write a script to find the path such that Knight can capture all +> treasures. The Knight can start from the top-left square. > -> BONUS: Try if it can handle triangle of size `10` or `20`. - -### Examples -~~~~ -Input: $N = 2 - - S - / \ - / _ \ - /\ /\ - /__\ /__\ E - -Output: RR, LHR, LHLH, LLHH, RLH, LRH -~~~~ - ~~~~ -Input: $N = 1 - - S - / \ - / _ \ E - -Output: R, LH + a b c d e f g h + 8 N * * * * * * * 8 + 7 * * * * * * * * 7 + 6 * * * * x * * * 6 + 5 * * * * * * * * 5 + 4 * * x * * * * * 4 + 3 * x * * * * * * 3 + 2 x x * * * * * * 2 + 1 * x * * * * * * 1 + a b c d e f g h ~~~~ ### Solutions @@ -86,4 +72,4 @@ Output: R, LH * [Ruby](ruby/ch-2.rb) ### Blog -[Find Possible Paths](https://abigail.github.io/HTML/Perl-Weekly-Challenge/week-117-2.html) +[Adventure of Knight](https://abigail.github.io/HTML/Perl-Weekly-Challenge/week-118-2.html) -- cgit From eff92d47c584ac99c453a0f5572d6bc0a2843da3 Mon Sep 17 00:00:00 2001 From: Abigail Date: Mon, 21 Jun 2021 13:20:20 +0200 Subject: Perl solution for week 118, part 1 --- challenge-118/abigail/perl/ch-1.pl | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 challenge-118/abigail/perl/ch-1.pl diff --git a/challenge-118/abigail/perl/ch-1.pl b/challenge-118/abigail/perl/ch-1.pl new file mode 100644 index 0000000000..99df6f0f65 --- /dev/null +++ b/challenge-118/abigail/perl/ch-1.pl @@ -0,0 +1,26 @@ +#!/opt/perl/bin/perl + +use 5.032; + +use strict; +use warnings; +no warnings 'syntax'; + +use experimental 'signatures'; +use experimental 'lexical_subs'; + +# +# See ../README.md +# + +# +# Run as: perl ch-1.pl < input-file +# + +# +# More efficient is to store the binary representation of the number +# in a variable, and see whether it's the same as its reverse, but +# using a pattern turns it into a one liner. +# + +say sprintf ("%b" => $_) =~ /^(([01])(?1)\g{2}|[01]?)$/ || 0 while <>; -- cgit From fb8b828cd7c83894fed534d9d1894981a0dce203 Mon Sep 17 00:00:00 2001 From: Abigail Date: Mon, 21 Jun 2021 14:12:53 +0200 Subject: AWK solution for week 118, part 1 --- challenge-118/abigail/awk/ch-1.awk | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 challenge-118/abigail/awk/ch-1.awk diff --git a/challenge-118/abigail/awk/ch-1.awk b/challenge-118/abigail/awk/ch-1.awk new file mode 100644 index 0000000000..490a5ceefc --- /dev/null +++ b/challenge-118/abigail/awk/ch-1.awk @@ -0,0 +1,36 @@ +#!/usr/bin/awk + +# +# See ../README.md +# + +# +# Run as: awk -f ch-1.awk < input-file +# + +# +# Get a binary representation +# +function dec2bin (dec, bin) { + while (dec) { + bin = dec % 2 bin + dec = int (dec / 2) + } + return (bin) +} + +{ + bin = dec2bin($1) + l = length (bin) + # + # Check if it's a palindrome + # + for (i = 1; i < l / 2; i ++) { + if (substr (bin, i, 1) != substr (bin, l - i + 1, 1)) { + print (0) + next + } + } + print (1) +} + -- cgit From 5ab7990c1199c721345fe3f9beb52634862f8396 Mon Sep 17 00:00:00 2001 From: Abigail Date: Mon, 21 Jun 2021 14:56:54 +0200 Subject: Bash solution for week 118, part 1 --- challenge-118/abigail/bash/ch-1.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 challenge-118/abigail/bash/ch-1.sh diff --git a/challenge-118/abigail/bash/ch-1.sh b/challenge-118/abigail/bash/ch-1.sh new file mode 100644 index 0000000000..873decd636 --- /dev/null +++ b/challenge-118/abigail/bash/ch-1.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +# +# See ../README.md +# + +# +# Run as: bash ch-1.sh < input-file +# + +set -f + +function dec2bin () { + dec=$1 + bin="" + while ((dec > 0)) + do bin=$((dec % 2))$bin + ((dec /= 2)) + done +} + +while read dec +do dec2bin $dec + for ((i = 0; i < ${#bin} / 2; i ++)) + do if [ "${bin:$i:1}" = "${bin:$((${#bin} - i - 1)):1}" ] + then continue + fi + echo 0 + continue 2 + done + echo 1 +done -- cgit From 8f7b0abc3ed0410970c5944e912f449a44f14a80 Mon Sep 17 00:00:00 2001 From: Abigail Date: Mon, 21 Jun 2021 15:25:11 +0200 Subject: C solution for week 118, part 1 --- challenge-118/abigail/c/ch-1.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 challenge-118/abigail/c/ch-1.c diff --git a/challenge-118/abigail/c/ch-1.c b/challenge-118/abigail/c/ch-1.c new file mode 100644 index 0000000000..637c938d0e --- /dev/null +++ b/challenge-118/abigail/c/ch-1.c @@ -0,0 +1,42 @@ +# include +# include +# include + +/* + * See ../README.md + */ + +/* + * Run as: cc -o ch-1.o ch-1.c; ./ch-1.o < input-file + */ + + +int main (void) { + long long dec; + while (scanf ("%lld", &dec) == 1) { + /* + * Find the largest power of 2 smaller than dec; + * this is the position of the leading 1. + */ + long long i = 1; + int k = 0; + for (k = 0; i <= dec; k ++, i = i << 1); + /* + * We overshot by 1 + */ + k -= 1; + + /* + * Now, compare the bits + */ + int is_palin = 1; + for (int j = 0; j < k; k --, j ++) { + if (((dec & (1 << j)) >> j) != ((dec & (1 << k)) >> k)) { + is_palin = 0; + break; + } + } + printf ("%d\n", is_palin); + } + return (0); +} -- cgit From 7ac27fdb94896a8250018ff135e72f9a99071f54 Mon Sep 17 00:00:00 2001 From: Abigail Date: Mon, 21 Jun 2021 18:48:27 +0200 Subject: Lua solution for week 118, part 1 --- challenge-118/abigail/lua/ch-1.lua | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 challenge-118/abigail/lua/ch-1.lua diff --git a/challenge-118/abigail/lua/ch-1.lua b/challenge-118/abigail/lua/ch-1.lua new file mode 100644 index 0000000000..a129db19e4 --- /dev/null +++ b/challenge-118/abigail/lua/ch-1.lua @@ -0,0 +1,32 @@ +#!/opt/local/bin/lua + +-- +-- See ../README.md +-- + +-- +-- Run as: lua ch-1.lua < input-file +-- + +-- +-- Find the binary representation of a number. +-- Note that the function return a string in reverse order; +-- this will do for our purpose as we want a palindrome anyway. +-- +function dec2bin (dec) + local bin = {} + while dec > 0 do + bin [#bin + 1] = dec % 2 + dec = math . floor (dec / 2) + end + return table . concat (bin) +end + +for line in io . lines () do + bin = dec2bin (tonumber (line)) + if bin == string . reverse (bin) then + print (1) + else + print (0) + end +end -- cgit From 7160801add8cbeff393124515ad2846da6265a69 Mon Sep 17 00:00:00 2001 From: Abigail Date: Mon, 21 Jun 2021 19:02:10 +0200 Subject: Node.js solution for week 118, part 1 --- challenge-118/abigail/node/ch-1.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 challenge-118/abigail/node/ch-1.js diff --git a/challenge-118/abigail/node/ch-1.js b/challenge-118/abigail/node/ch-1.js new file mode 100644 index 0000000000..7247cb5eef --- /dev/null +++ b/challenge-118/abigail/node/ch-1.js @@ -0,0 +1,16 @@ +#!/usr/local/bin/node + +// +// See ../README.md +// + +// +// Run as: node ch-1.js < input-file +// + + require ('readline') +. createInterface ({input: process . stdin}) +. on ('line', (line) => { + let bin = (+line) . toString (2) + console . log (bin == bin . split ("") . reverse () . join ("") ? 1 : 0) +}) -- cgit From f245cfefa46f122166a0034aa82507ea2b84ee5e Mon Sep 17 00:00:00 2001 From: Abigail Date: Mon, 21 Jun 2021 19:29:32 +0200 Subject: Python solution for week 118, part 1 --- challenge-118/abigail/python/ch-1.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 challenge-118/abigail/python/ch-1.py diff --git a/challenge-118/abigail/python/ch-1.py b/challenge-118/abigail/python/ch-1.py new file mode 100644 index 0000000000..df0451a44e --- /dev/null +++ b/challenge-118/abigail/python/ch-1.py @@ -0,0 +1,19 @@ +#!/opt/local/bin/python + +# +# See ../README.md +# + +# +# Run as: python ch-1.py < input-file +# + +import fileinput + +for line in fileinput . input (): + bin = '{:b}' . format (int (line)) # Turn to binary representation + if bin == bin [::-1]: # bin [::-1] reverse the string + print (1) + else: + print (0) + -- cgit From 1b31356bcb86b22fa81bd86f0a4345cf0eb9e784 Mon Sep 17 00:00:00 2001 From: Abigail Date: Mon, 21 Jun 2021 19:42:25 +0200 Subject: Ruby solution for week 118, part 1 --- challenge-118/abigail/ruby/ch-1.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 challenge-118/abigail/ruby/ch-1.rb diff --git a/challenge-118/abigail/ruby/ch-1.rb b/challenge-118/abigail/ruby/ch-1.rb new file mode 100644 index 0000000000..2609253a2d --- /dev/null +++ b/challenge-118/abigail/ruby/ch-1.rb @@ -0,0 +1,15 @@ +#!/usr/bin/ruby + +# +# See ../README.md +# + +# +# Run as: ruby ch-1.rb < input-file +# + +ARGF . each_line do + |dec| + bin = "%b" % dec + puts (bin == bin . reverse ? 1 : 0) +end -- cgit From d37b3bd215636fd3dbac1935a6cfd4dd42a1d7cb Mon Sep 17 00:00:00 2001 From: Abigail Date: Mon, 21 Jun 2021 20:24:14 +0200 Subject: Go solution for week 118, part 1 --- challenge-118/abigail/go/ch-1.go | 41 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 challenge-118/abigail/go/ch-1.go diff --git a/challenge-118/abigail/go/ch-1.go b/challenge-118/abigail/go/ch-1.go new file mode 100644 index 0000000000..466a5e574f --- /dev/null +++ b/challenge-118/abigail/go/ch-1.go @@ -0,0 +1,41 @@ +package main + +// +// See ../README.md +// + +// +// Run as: go run ch-1.go +// + +import ( + "fmt" + "strconv" +) + +func reverse (str string) string { + rev := [] rune (str) + for i, j := 0, len (rev) - 1; i < j; i, j = i + 1, j - 1 { + rev [i], rev [j] = rev [j], rev [i] + } + return string (rev) +} + +func main () { + var dec int64 + for { + var n, err = fmt . Scanf ("%d", &dec) + if (n != 1 || err != nil) { + break + } + var bin = strconv . FormatInt (dec, 2) + if (bin == reverse (bin)) { + fmt . Println (1) + } else { + fmt . Println (0) + } + } +} + + + -- cgit From c96706ce3310f524797452e334c84bbff90a9a5d Mon Sep 17 00:00:00 2001 From: Abigail Date: Mon, 21 Jun 2021 22:02:41 +0200 Subject: Java solution for week 118, part 1 --- challenge-118/abigail/java/ch-1.java | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 challenge-118/abigail/java/ch-1.java diff --git a/challenge-118/abigail/java/ch-1.java b/challenge-118/abigail/java/ch-1.java new file mode 100644 index 0000000000..a806d2c237 --- /dev/null +++ b/challenge-118/abigail/java/ch-1.java @@ -0,0 +1,34 @@ +// +// See ../README.md +// + +// +// Run as: ln ch-1.java ch1.java; javac ch1.java; java ch1 < input-file +// + +import java.util.*; + +public class ch1 { + public static void main (String [] args) { + Scanner scanner = new Scanner (System . in); + try { + while (true) { + int dec = scanner . nextInt (); + String bin = Integer . toBinaryString (dec); + + if (bin . equals (new StringBuilder (bin) . + reverse () . toString ())) { + System . out . println (1); + } + else { + System . out . println (0); + } + } + } + catch (Exception e) { + // + // EOF + // + } + } +} -- cgit From 0b3b62e85d589d3389982c7eefb6865459c93934 Mon Sep 17 00:00:00 2001 From: Abigail Date: Tue, 22 Jun 2021 18:31:06 +0200 Subject: Perl solution for week 118, part 2 --- challenge-118/abigail/perl/ch-2.pl | 49 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 challenge-118/abigail/perl/ch-2.pl diff --git a/challenge-118/abigail/perl/ch-2.pl b/challenge-118/abigail/perl/ch-2.pl new file mode 100644 index 0000000000..e0dafb03f0 --- /dev/null +++ b/challenge-118/abigail/perl/ch-2.pl @@ -0,0 +1,49 @@ +#!/opt/perl/bin/perl + +use 5.032; + +use strict; +use warnings; +no warnings 'syntax'; + +use experimental 'signatures'; +use experimental 'lexical_subs'; + +# +# See ../README.md +# + +# +# Run as: perl ch-2.pl +# +# First thing which spring to mind is: there is a closed knight's tour +# on a chess board. In fact, there are 19,591,828,170,979,904 of them +# (counting rotations and reflections, but not direction). See A165134 +# in the OEIS. (And there are also billions of open tours visiting all +# squares...) +# +# And any knight's tour will visit all squares, including the ones with +# treasure. So, we could just pick a tour visiting all squares and +# calling it a day. This would turn the challenge into a glorified +# Hello World! program. +# +# So, perhaps we should focus on the bonus part. +# +# But wait, there's no variable input. There's just a fixed board +# to work with. And one can quickly see there's an 11 step path +# visiting all the treasure, and no 10 step path. +# +# So, this challenge is yet another boring Hello, World! program. +# After all, it's much easier to write down the 11 knights moves than +# to write a program. +# +# To up the ante, we'll write a second program (ch-2a.pl) which actually +# reads input and does calculations. But the main solution will just print +# out the 11-move path. +# +# I really do hope the PWC steps away from fixed output challenges. +# + +say "c7 e6 c5 b3 c1 a2 c3 b1 d2 c4 b2"; + +__END__ -- cgit From cea0a95b6889a97885e46c6147faf21a4888af25 Mon Sep 17 00:00:00 2001 From: Abigail Date: Tue, 22 Jun 2021 18:31:47 +0200 Subject: Upping the ante for week 118, part 2 (Perl) --- challenge-118/abigail/perl/ch-2a.pl | 102 ++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 challenge-118/abigail/perl/ch-2a.pl diff --git a/challenge-118/abigail/perl/ch-2a.pl b/challenge-118/abigail/perl/ch-2a.pl new file mode 100644 index 0000000000..f2bbef804c --- /dev/null +++ b/challenge-118/abigail/perl/ch-2a.pl @@ -0,0 +1,102 @@ +#!/opt/perl/bin/perl + +use 5.032; + +use strict; +use warnings; +no warnings 'syntax'; + +use experimental 'signatures'; +use experimental 'lexical_subs'; + +# +# See ../README.md +# + +# +# Run as: perl ch-2a.pl < input-file +# +# Second solution; this time we actually read a challenge from +# STDIN. Each line of input stands for another challenge, +# Each line consists of 2 or more chess squares; the first is +# the starting point of the knight, the rest treasures to be visited. +# + +my $MAX_FILE = 8; +my $MAX_RANK = 8; + +# +# Given a file and rank as numbers, return the algebraic name of a square +# +sub c2a ($file, $rank) { + sprintf "%c%d", ord ('a') + $file - 1, $rank +} + +# +# Precompute all knight moves on the board. +# +my %knight_moves; # Maps square to all squares reachable from it. +for my $file (1 .. $MAX_FILE) { + for my $rank (1 .. $MAX_RANK) { + my $square = c2a $file, $rank; + # + # Consider only moves in one direction; we add reverse moves as well. + # Knight moves 2 in one direction, and 1 orthogonally from that. + # + for my $move ([1, 2], [1, -2], [2, 1], [2, -1]) { + next unless 1 <= $file + $$move [0] <= $MAX_FILE && + 1 <= $rank + $$move [1] <= $MAX_RANK; + my $target = c2a $file + $$move [0], $rank + $$move [1]; + push @{$knight_moves {$square}} => $target; + push @{$knight_moves {$target}} => $square; + } + } +} + + + +# +# Given a starting square, and a set of treasure locations, do a +# breath first search to find a shortest path visiting all the +# treasure locations. +# +# Note that we do allow to revisit squares, but only if they have a +# different set of visited "treasure" squares. It is after all possible +# that the shortest path revisits squares. +# +sub find_treasure ($start_square, @treasure) { + my %treasure = map {$_ => 1} @treasure; + + my %visited; # Maps square x seen treasure to 1 + + my @todo = ([[$start_square], {}]); + # Entries in the @todo list are tuples: + # - The path that got us here; the last element being + # the "current" square + # - A mapping of which treasure squares we have visited + # on the path. + + while (@todo) { + my ($path, $old_seen) = @{shift @todo}; + my $square = $$path [-1]; + my $seen = {%$old_seen}; + $$seen {$square} = 1 if $treasure {$square}; + + my $key = join " " => $square, sort keys %$seen; + next if $visited {$key} ++; + + if (keys %$seen == keys %treasure) { + # + # We have seen all the treasure: return the path. + # + return $path; + } + + push @todo => map {[[@$path => $_], $seen]} @{$knight_moves {$square}}; + } +} + + +say "@{find_treasure split}" while <>; + +__END__ -- cgit From ef87285d2c8d743bf79a781d1a4314d4c30d12a3 Mon Sep 17 00:00:00 2001 From: Abigail Date: Tue, 22 Jun 2021 19:57:37 +0200 Subject: Print starting square --- challenge-118/abigail/perl/ch-2.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/challenge-118/abigail/perl/ch-2.pl b/challenge-118/abigail/perl/ch-2.pl index e0dafb03f0..3a28598fac 100644 --- a/challenge-118/abigail/perl/ch-2.pl +++ b/challenge-118/abigail/perl/ch-2.pl @@ -44,6 +44,6 @@ use experimental 'lexical_subs'; # I really do hope the PWC steps away from fixed output challenges. # -say "c7 e6 c5 b3 c1 a2 c3 b1 d2 c4 b2"; +say "a8 c7 e6 c5 b3 c1 a2 c3 b1 d2 c4 b2"; __END__ -- cgit From d2907c9dfe40252ea7e11c7c822f06ea2bc793bf Mon Sep 17 00:00:00 2001 From: Abigail Date: Tue, 22 Jun 2021 19:57:51 +0200 Subject: Tests for week 118 --- challenge-118/abigail/t/ctest.ini | 7 +++++++ challenge-118/abigail/t/input-1-1 | 2 ++ challenge-118/abigail/t/input-2-1 | 1 + challenge-118/abigail/t/output-1-1.exp | 2 ++ challenge-118/abigail/t/output-2-1.exp | 1 + 5 files changed, 13 insertions(+) create mode 100644 challenge-118/abigail/t/ctest.ini create mode 100644 challenge-118/abigail/t/input-1-1 create mode 100644 challenge-118/abigail/t/input-2-1 create mode 100644 challenge-118/abigail/t/output-1-1.exp create mode 100644 challenge-118/abigail/t/output-2-1.exp diff --git a/challenge-118/abigail/t/ctest.ini b/challenge-118/abigail/t/ctest.ini new file mode 100644 index 0000000000..d1a3f6baf6 --- /dev/null +++ b/challenge-118/abigail/t/ctest.ini @@ -0,0 +1,7 @@ +# +# Configuration file for running tests, using ctest. +# See https://github.com/Abigail/Misc/blob/master/ctest +# + +[names] +1-1 = Given Examples diff --git a/challenge-118/abigail/t/input-1-1 b/challenge-118/abigail/t/input-1-1 new file mode 100644 index 0000000000..b5104f3ba9 --- /dev/null +++ b/challenge-118/abigail/t/input-1-1 @@ -0,0 +1,2 @@ +5 +4 diff --git a/challenge-118/abigail/t/input-2-1 b/challenge-118/abigail/t/input-2-1 new file mode 100644 index 0000000000..376243accc --- /dev/null +++ b/challenge-118/abigail/t/input-2-1 @@ -0,0 +1 @@ +a8 b1 a2 b2 b3 c4 e6 diff --git a/challenge-118/abigail/t/output-1-1.exp b/challenge-118/abigail/t/output-1-1.exp new file mode 100644 index 0000000000..b261da18d5 --- /dev/null +++ b/challenge-118/abigail/t/output-1-1.exp @@ -0,0 +1,2 @@ +1 +0 diff --git a/challenge-118/abigail/t/output-2-1.exp b/challenge-118/abigail/t/output-2-1.exp new file mode 100644 index 0000000000..47e497232b --- /dev/null +++ b/challenge-118/abigail/t/output-2-1.exp @@ -0,0 +1 @@ +a8 c7 e6 c5 b3 c1 a2 c3 b1 d2 c4 b2 -- cgit From f23ea63093e2ae3a4cba10e54b374d9b46f9b764 Mon Sep 17 00:00:00 2001 From: Abigail Date: Tue, 22 Jun 2021 20:04:40 +0200 Subject: Move via a3 instead of d2 --- challenge-118/abigail/perl/ch-2.pl | 2 +- challenge-118/abigail/t/output-2-1.exp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/challenge-118/abigail/perl/ch-2.pl b/challenge-118/abigail/perl/ch-2.pl index 3a28598fac..2d224fd1fc 100644 --- a/challenge-118/abigail/perl/ch-2.pl +++ b/challenge-118/abigail/perl/ch-2.pl @@ -44,6 +44,6 @@ use experimental 'lexical_subs'; # I really do hope the PWC steps away from fixed output challenges. # -say "a8 c7 e6 c5 b3 c1 a2 c3 b1 d2 c4 b2"; +say "a8 c7 e6 c5 b3 c1 a2 c3 b1 a3 c4 b2"; __END__ diff --git a/challenge-118/abigail/t/output-2-1.exp b/challenge-118/abigail/t/output-2-1.exp index 47e497232b..f0803658c1 100644 --- a/challenge-118/abigail/t/output-2-1.exp +++ b/challenge-118/abigail/t/output-2-1.exp @@ -1 +1 @@ -a8 c7 e6 c5 b3 c1 a2 c3 b1 d2 c4 b2 +a8 c7 e6 c5 b3 c1 a2 c3 b1 a3 c4 b2 -- cgit From 9c47a695c2f01a7fb23e1647c40b5c31ade33c2f Mon Sep 17 00:00:00 2001 From: Abigail Date: Tue, 22 Jun 2021 20:12:51 +0200 Subject: Solutions for 29 languages. Since we have a gloried Hello, World! challenge.... --- challenge-118/abigail/awk/ch-2.awk | 14 ++++++++++++++ challenge-118/abigail/bash/ch-2.sh | 11 +++++++++++ challenge-118/abigail/basic/ch-2.bas | 9 +++++++++ challenge-118/abigail/bc/ch-2.bc | 10 ++++++++++ challenge-118/abigail/befunge-93/ch-2.bf93 | 2 ++ challenge-118/abigail/c/ch-2.c | 16 ++++++++++++++++ challenge-118/abigail/cobol/ch-2.cb | 14 ++++++++++++++ challenge-118/abigail/csh/ch-2.csh | 11 +++++++++++ challenge-118/abigail/erlang/ch-2.erl | 15 +++++++++++++++ challenge-118/abigail/forth/ch-2.fs | 5 +++++ challenge-118/abigail/fortran/ch-2.f90 | 12 ++++++++++++ challenge-118/abigail/go/ch-2.go | 15 +++++++++++++++ challenge-118/abigail/java/ch-2.java | 13 +++++++++++++ challenge-118/abigail/lua/ch-2.lua | 11 +++++++++++ challenge-118/abigail/m4/ch-2.m4 | 1 + challenge-118/abigail/mmix/ch-2.mms | 16 ++++++++++++++++ challenge-118/abigail/node/ch-2.js | 11 +++++++++++ challenge-118/abigail/ocaml/ch-2.ml | 9 +++++++++ challenge-118/abigail/pascal/ch-2.p | 13 +++++++++++++ challenge-118/abigail/php/ch-2.php | 11 +++++++++++ challenge-118/abigail/postscript/ch-2.ps | 10 ++++++++++ challenge-118/abigail/python/ch-2.py | 11 +++++++++++ challenge-118/abigail/r/ch-2.r | 9 +++++++++ challenge-118/abigail/rexx/ch-2.rexx | 9 +++++++++ challenge-118/abigail/ruby/ch-2.rb | 11 +++++++++++ challenge-118/abigail/scheme/ch-2.scm | 9 +++++++++ challenge-118/abigail/sed/ch-2.sed | 12 ++++++++++++ challenge-118/abigail/sql/ch-2.sql | 9 +++++++++ challenge-118/abigail/tcl/ch-2.tcl | 9 +++++++++ 29 files changed, 308 insertions(+) create mode 100644 challenge-118/abigail/awk/ch-2.awk create mode 100644 challenge-118/abigail/bash/ch-2.sh create mode 100644 challenge-118/abigail/basic/ch-2.bas create mode 100644 challenge-118/abigail/bc/ch-2.bc create mode 100644 challenge-118/abigail/befunge-93/ch-2.bf93 create mode 100644 challenge-118/abigail/c/ch-2.c create mode 100644 challenge-118/abigail/cobol/ch-2.cb create mode 100644 challenge-118/abigail/csh/ch-2.csh create mode 100644 challenge-118/abigail/erlang/ch-2.erl create mode 100644 challenge-118/abigail/forth/ch-2.fs create mode 100644 challenge-118/abigail/fortran/ch-2.f90 create mode 100644 challenge-118/abigail/go/ch-2.go create mode 100644 challenge-118/abigail/java/ch-2.java create mode 100644 challenge-118/abigail/lua/ch-2.lua create mode 100644 challenge-118/abigail/m4/ch-2.m4 create mode 100644 challenge-118/abigail/mmix/ch-2.mms create mode 100644 challenge-118/abigail/node/ch-2.js create mode 100644 challenge-118/abigail/ocaml/ch-2.ml create mode 100644 challenge-118/abigail/pascal/ch-2.p create mode 100644 challenge-118/abigail/php/ch-2.php create mode 100644 challenge-118/abigail/postscript/ch-2.ps create mode 100644 challenge-118/abigail/python/ch-2.py create mode 100644 challenge-118/abigail/r/ch-2.r create mode 100644 challenge-118/abigail/rexx/ch-2.rexx create mode 100644 challenge-118/abigail/ruby/ch-2.rb create mode 100644 challenge-118/abigail/scheme/ch-2.scm create mode 100644 challenge-118/abigail/sed/ch-2.sed create mode 100644 challenge-118/abigail/sql/ch-2.sql create mode 100644 challenge-118/abigail/tcl/ch-2.tcl diff --git a/challenge-118/abigail/awk/ch-2.awk b/challenge-118/abigail/awk/ch-2.awk new file mode 100644 index 0000000000..d4cf905f2e --- /dev/null +++ b/challenge-118/abigail/awk/ch-2.awk @@ -0,0 +1,14 @@ +#!/usr/bin/awk + +# +# See ../README.md +# + +# +# Run as: awk -f ch-2.awk +# + +BEGIN { + print "a8 c7 e6 c5 b3 c1 a2 c3 b1 a3 c4 b2" +} + diff --git a/challenge-118/abigail/bash/ch-2.sh b/challenge-118/abigail/bash/ch-2.sh new file mode 100644 index 0000000000..e48430410e --- /dev/null +++ b/challenge-118/abigail/bash/ch-2.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +# +# See ../README.md +# + +# +# Run as: bash ch-2.sh +# + +echo "a8 c7 e6 c5 b3 c1 a2 c3 b1 a3 c4 b2" diff --git a/challenge-118/abigail/basic/ch-2.bas b/challenge-118/abigail/basic/ch-2.bas new file mode 100644 index 0000000000..8e07ba8840 --- /dev/null +++ b/challenge-118/abigail/basic/ch-2.bas @@ -0,0 +1,9 @@ +010 REM +020 REM See ../README.md +030 REM + +040 REM +050 REM Run as: basic ch-2.bas +060 REM + +100 PRINT "a8 c7 e6 c5 b3 c1 a2 c3 b1 a3 c4 b2" diff --git a/challenge-118/abigail/bc/ch-2.bc b/challenge-118/abigail/bc/ch-2.bc new file mode 100644 index 0000000000..5125d6a827 --- /dev/null +++ b/challenge-118/abigail/bc/ch-2.bc @@ -0,0 +1,10 @@ +# +# See ../README.md +# + +# +# Run as: bc ch-2.bc +# +"a8 c7 e6 c5 b3 c1 a2 c3 b1 a3 c4 b2 +" +quit diff --git a/challenge-118/abigail/befunge-93/ch-2.bf93 b/challenge-118/abigail/befunge-93/ch-2.bf93 new file mode 100644 index 0000000000..b31e3efee9 --- /dev/null +++ b/challenge-118/abigail/befunge-93/ch-2.bf93 @@ -0,0 +1,2 @@ +< v,_@#:< "a8 c7 e6 c5 b3 c1 a2 c3 b1 a3 c4 b2" +55 + > ^ diff --git a/challenge-118/abigail/c/ch-2.c b/challenge-118/abigail/c/ch-2.c new file mode 100644 index 0000000000..74531ee18d --- /dev/null +++ b/challenge-118/abigail/c/ch-2.c @@ -0,0 +1,16 @@ +# include +# include +# include + +/* + * See ../README.md + */ + +/* + * Run as: cc -o ch-2.o ch-2.c; ./ch-2.o + */ + +int main (void) { + printf ("a8 c7 e6 c5 b3 c1 a2 c3 b1 a3 c4 b2\n"); + exit (0); +} diff --git a/challenge-118/abigail/cobol/ch-2.cb b/challenge-118/abigail/cobol/ch-2.cb new file mode 100644 index 0000000000..a756c0f8d2 --- /dev/null +++ b/challenge-118/abigail/cobol/ch-2.cb @@ -0,0 +1,14 @@ +IDENTIFICATION DIVISION. +PROGRAM-ID. XXX. + +*> +*> See ../README.md +*> + +*> +*> Run as: cobc -xF -o ch-2.o ch-2.cb; ./ch-2.o +*> + +PROCEDURE DIVISION. + DISPLAY "a8 c7 e6 c5 b3 c1 a2 c3 b1 a3 c4 b2". + STOP RUN. diff --git a/challenge-118/abigail/csh/ch-2.csh b/challenge-118/abigail/csh/ch-2.csh new file mode 100644 index 0000000000..bdcc9cee6d --- /dev/null +++ b/challenge-118/abigail/csh/ch-2.csh @@ -0,0 +1,11 @@ +#!/bin/csh + +# +# See ../README.md +# + +# +# Run as: csh ch-2.csh +# + +echo "a8 c7 e6 c5 b3 c1 a2 c3 b1 a3 c4 b2" diff --git a/challenge-118/abigail/erlang/ch-2.erl b/challenge-118/abigail/erlang/ch-2.erl new file mode 100644 index 0000000000..8357a62e7d --- /dev/null +++ b/challenge-118/abigail/erlang/ch-2.erl @@ -0,0 +1,15 @@ +% +% See ../README.md +% + +% +% Run as: ln ch-2.erl ch2.erl +% erl -compile ch2 +% erl -noshell -s ch2 main -s init stop +% + +-module (ch2). +-export ([main/0]). + +main () -> + io:fwrite ("a8 c7 e6 c5 b3 c1 a2 c3 b1 a3 c4 b2\n"). diff --git a/challenge-118/abigail/forth/ch-2.fs b/challenge-118/abigail/forth/ch-2.fs new file mode 100644 index 0000000000..adf08a7137 --- /dev/null +++ b/challenge-118/abigail/forth/ch-2.fs @@ -0,0 +1,5 @@ +\ +\ See ../README.md +\ + +.( a8 c7 e6 c5 b3 c1 a2 c3 b1 a3 c4 b2) diff --git a/challenge-118/abigail/fortran/ch-2.f90 b/challenge-118/abigail/fortran/ch-2.f90 new file mode 100644 index 0000000000..bb8c2851b0 --- /dev/null +++ b/challenge-118/abigail/fortran/ch-2.f90 @@ -0,0 +1,12 @@ +! +! See ../README.md +! + +! +! Run as: gfortran -o ch-2.o ch-2.f90; ./ch-2.o +! + +program ch2 + implicit none + write (*, *) "a8 c7 e6 c5 b3 c1 a2 c3 b1 a3 c4 b2" +end diff --git a/challenge-118/abigail/go/ch-2.go b/challenge-118/abigail/go/ch-2.go new file mode 100644 index 0000000000..6fd5616aec --- /dev/null +++ b/challenge-118/abigail/go/ch-2.go @@ -0,0 +1,15 @@ +package main + +// +// See ../README.md +// + +// +// Run as: go run ch-2.go +// + +import "fmt" + +func main () { + fmt . Print ("a8 c7 e6 c5 b3 c1 a2 c3 b1 a3 c4 b2\n") +} diff --git a/challenge-118/abigail/java/ch-2.java b/challenge-118/abigail/java/ch-2.java new file mode 100644 index 0000000000..d9f0c4edcc --- /dev/null +++ b/challenge-118/abigail/java/ch-2.java @@ -0,0 +1,13 @@ +// +// See ../README.md +// + +// +// Run as: ln ch-2.java ch2.java; javac ch2; java ch2 +// + +public class ch2 { + public static void main (String [] args) { + System . out . print ("a8 c7 e6 c5 b3 c1 a2 c3 b1 a3 c4 b2\n"); + } +} diff --git a/challenge-118/abigail/lua/ch-2.lua b/challenge-118/abigail/lua/ch-2.lua new file mode 100644 index 0000000000..5c40dfc99c --- /dev/null +++ b/challenge-118/abigail/lua/ch-2.lua @@ -0,0 +1,11 @@ +#!/opt/local/bin/lua + +-- +-- See ../README.md +-- + +-- +-- Run as: lua ch-2.lua +-- + +print ("a8 c7 e6 c5 b3 c1 a2 c3 b1 a3 c4 b2") diff --git a/challenge-118/abigail/m4/ch-2.m4 b/challenge-118/abigail/m4/ch-2.m4 new file mode 100644 index 0000000000..6ebcee6dd2 --- /dev/null +++ b/challenge-118/abigail/m4/ch-2.m4 @@ -0,0 +1 @@ +a8 c7 e6 c5 b3 c1 a2 c3 b1 a3 c4 b2 diff --git a/challenge-118/abigail/mmix/ch-2.mms b/challenge-118/abigail/mmix/ch-2.mms new file mode 100644 index 0000000000..416ce1c81e --- /dev/null +++ b/challenge-118/abigail/mmix/ch-2.mms @@ -0,0 +1,16 @@ +% +% See ../README.md +% + +% +% Run as: mmixal -o ch-2.mmo ch-2.mms; mmix -q ch-2.mmo +% + LOC Data_Segment + GREG @ +Text BYTE "a8 c7 e6 c5 b3 c1 a2 c3 b1 a3 c4 b2",10,0 + + LOC #100 + +Main LDA $255,Text + TRAP 0,Fputs,StdOut + TRAP 0,Halt,0 diff --git a/challenge-118/abigail/node/ch-2.js b/challenge-118/abigail/node/ch-2.js new file mode 100644 index 0000000000..e032ef0448 --- /dev/null +++ b/challenge-118/abigail/node/ch-2.js @@ -0,0 +1,11 @@ +#!/usr/local/bin/node + +// +// See ../README.md +// + +// +// Run as: node ch-2.js +// + +console . log ("a8 c7 e6 c5 b3 c1 a2 c3 b1 a3 c4 b2") diff --git a/challenge-118/abigail/ocaml/ch-2.ml b/challenge-118/abigail/ocaml/ch-2.ml new file mode 100644 index 0000000000..553e3af70f --- /dev/null +++ b/challenge-118/abigail/ocaml/ch-2.ml @@ -0,0 +1,9 @@ +(* *) +(* See ../README.md *) +(* *) + +(* *) +(* Run as: ocaml ch-2.ml *) +(* *) + +print_endline "a8 c7 e6 c5 b3 c1 a2 c3 b1 a3 c4 b2"; diff --git a/challenge-118/abigail/pascal/ch-2.p b/challenge-118/abigail/pascal/ch-2.p new file mode 100644 index 0000000000..e95a839a4b --- /dev/null +++ b/challenge-118/abigail/pascal/ch-2.p @@ -0,0 +1,13 @@ +Program XXX; + +(* *) +(* See ../README.md *) +(* *) + +(* *) +(* Run as: fpc -och-1.out ch-2.p; ./ch-2.out *) +(* *) + +begin + writeln ('a8 c7 e6 c5 b3 c1 a2 c3 b1 a3 c4 b2') +end. diff --git a/challenge-118/abigail/php/ch-2.php b/challenge-118/abigail/php/ch-2.php new file mode 100644 index 0000000000..46cfeff6a7 --- /dev/null +++ b/challenge-118/abigail/php/ch-2.php @@ -0,0 +1,11 @@ + diff --git a/challenge-118/abigail/postscript/ch-2.ps b/challenge-118/abigail/postscript/ch-2.ps new file mode 100644 index 0000000000..97a3a77cd3 --- /dev/null +++ b/challenge-118/abigail/postscript/ch-2.ps @@ -0,0 +1,10 @@ +%!PS +% +% See ../README.md +% + +% +% Run as: ps2ascii ch-2.ps +% + +(a8 c7 e6 c5 b3 c1 a2 c3 b1 a3 c4 b2) = diff --git a/challenge-118/abigail/python/ch-2.py b/challenge-118/abigail/python/ch-2.py new file mode 100644 index 0000000000..12dd966554 --- /dev/null +++ b/challenge-118/abigail/python/ch-2.py @@ -0,0 +1,11 @@ +#!/opt/local/bin/python + +# +# See ../README.md +# + +# +# Run as: python ch-2.py +# + +print ("a8 c7 e6 c5 b3 c1 a2 c3 b1 a3 c4 b2") diff --git a/challenge-118/abigail/r/ch-2.r b/challenge-118/abigail/r/ch-2.r new file mode 100644 index 0000000000..b021f84006 --- /dev/null +++ b/challenge-118/abigail/r/ch-2.r @@ -0,0 +1,9 @@ +# +# See ../README.md +# + +# +# Run as: Rscript ch-2.r +# + +cat ("a8 c7 e6 c5 b3 c1 a2 c3 b1 a3 c4 b2\n") diff --git a/challenge-118/abigail/rexx/ch-2.rexx b/challenge-118/abigail/rexx/ch-2.rexx new file mode 100644 index 0000000000..f77556e087 --- /dev/null +++ b/challenge-118/abigail/rexx/ch-2.rexx @@ -0,0 +1,9 @@ +/* + * See ../README.md + */ + +/* + * Run as: rexx ch-2.rexx + */ + +say "a8 c7 e6 c5 b3 c1 a2 c3 b1 a3 c4 b2" diff --git a/challenge-118/abigail/ruby/ch-2.rb b/challenge-118/abigail/ruby/ch-2.rb new file mode 100644 index 0000000000..0a575319f9 --- /dev/null +++ b/challenge-118/abigail/ruby/ch-2.rb @@ -0,0 +1,11 @@ +#!/usr/bin/ruby + +# +# See ../README.md +# + +# +# Run as: ruby ch-2.rb +# + +puts ("a8 c7 e6 c5 b3 c1 a2 c3 b1 a3 c4 b2"); diff --git a/challenge-118/abigail/scheme/ch-2.scm b/challenge-118/abigail/scheme/ch-2.scm new file mode 100644 index 0000000000..def3bfb2b5 --- /dev/null +++ b/challenge-118/abigail/scheme/ch-2.scm @@ -0,0 +1,9 @@ +;;; +;;; See ../README.md +;;; + +;;; +;;; Run as: guile --no-auto-compile ch-2.scm +;;; + +(display "a8 c7 e6 c5 b3 c1 a2 c3 b1 a3 c4 b2\n") diff --git a/challenge-118/abigail/sed/ch-2.sed b/challenge-118/abigail/sed/ch-2.sed new file mode 100644 index 0000000000..e7d2004aa5 --- /dev/null +++ b/challenge-118/abigail/sed/ch-2.sed @@ -0,0 +1,12 @@ +# +# See ../README.md +# + +# +# Run as: sed -f ch-2.sed +# +# For each line in the input file, we write the first three +# self-describing numbers. +# + +s/.*/a8 c7 e6 c5 b3 c1 a2 c3 b1 a3 c4 b2/ diff --git a/challenge-118/abigail/sql/ch-2.sql b/challenge-118/abigail/sql/ch-2.sql new file mode 100644 index 0000000000..5ff02b7df8 --- /dev/null +++ b/challenge-118/abigail/sql/ch-2.sql @@ -0,0 +1,9 @@ +-- +-- See ../README.md +-- + +-- +-- Run as: sqlite3 < ch-2.sql +-- + +SELECT "a8 c7 e6 c5 b3 c1 a2 c3 b1 a3 c4 b2"; diff --git a/challenge-118/abigail/tcl/ch-2.tcl b/challenge-118/abigail/tcl/ch-2.tcl new file mode 100644 index 0000000000..f1e2f7b109 --- /dev/null +++ b/challenge-118/abigail/tcl/ch-2.tcl @@ -0,0 +1,9 @@ +# +# See ../README.md +# + +# +# Run as: tclsh ch-2.tcl +# + +puts "a8 c7 e6 c5 b3 c1 a2 c3 b1 a3 c4 b2" -- cgit From ed65f9e4f5f0e1200acedd279bcb6e52b4cecb2b Mon Sep 17 00:00:00 2001 From: Abigail Date: Tue, 22 Jun 2021 20:14:46 +0200 Subject: Don't give the SQL solution input --- challenge-118/abigail/t/ctest.ini | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/challenge-118/abigail/t/ctest.ini b/challenge-118/abigail/t/ctest.ini index d1a3f6baf6..261644e4f1 100644 --- a/challenge-118/abigail/t/ctest.ini +++ b/challenge-118/abigail/t/ctest.ini @@ -5,3 +5,7 @@ [names] 1-1 = Given Examples +2-1 = Given Example + +[2-1/sql] +no_input = 1 -- cgit From 1e4f18c8552dec891946162593a2bd451f8ca30b Mon Sep 17 00:00:00 2001 From: Abigail Date: Sat, 26 Jun 2021 20:00:58 +0200 Subject: Swap clauses in pattern --- challenge-118/abigail/perl/ch-1.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/challenge-118/abigail/perl/ch-1.pl b/challenge-118/abigail/perl/ch-1.pl index 99df6f0f65..51892d3f65 100644 --- a/challenge-118/abigail/perl/ch-1.pl +++ b/challenge-118/abigail/perl/ch-1.pl @@ -23,4 +23,4 @@ use experimental 'lexical_subs'; # using a pattern turns it into a one liner. # -say sprintf ("%b" => $_) =~ /^(([01])(?1)\g{2}|[01]?)$/ || 0 while <>; +say sprintf ("%b" => $_) =~ /^([01]?|([01])(?1)\g{2})$/ || 0 while <>; -- cgit From 5728d9694d49652756f62e54d6932879aed12198 Mon Sep 17 00:00:00 2001 From: Abigail Date: Sat, 26 Jun 2021 23:43:36 +0200 Subject: Refer to blog for proving 11 steps is the minimum --- challenge-118/abigail/perl/ch-2.pl | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/challenge-118/abigail/perl/ch-2.pl b/challenge-118/abigail/perl/ch-2.pl index 2d224fd1fc..ca49d52bc2 100644 --- a/challenge-118/abigail/perl/ch-2.pl +++ b/challenge-118/abigail/perl/ch-2.pl @@ -17,10 +17,10 @@ use experimental 'lexical_subs'; # Run as: perl ch-2.pl # # First thing which spring to mind is: there is a closed knight's tour -# on a chess board. In fact, there are 19,591,828,170,979,904 of them -# (counting rotations and reflections, but not direction). See A165134 -# in the OEIS. (And there are also billions of open tours visiting all -# squares...) +# on a chess board. In fact, there are 26,534,728,821,064 directed closed +# tours (counting reflections and rotations). If we include open tours +# (where we end not a knights move away from the start), this number +# rises to 19,591,828,170,979,904. See A165134 in the OEIS. # # And any knight's tour will visit all squares, including the ones with # treasure. So, we could just pick a tour visiting all squares and @@ -33,6 +33,9 @@ use experimental 'lexical_subs'; # to work with. And one can quickly see there's an 11 step path # visiting all the treasure, and no 10 step path. # +# (See https://abigail.github.io/HTML/Perl-Weekly-Challenge/week- 118-2.html +# for details why 11 steps is the minimum). +# # So, this challenge is yet another boring Hello, World! program. # After all, it's much easier to write down the 11 knights moves than # to write a program. -- cgit From da80a91ca4016d128de65555df68d9f2ca29345e Mon Sep 17 00:00:00 2001 From: Abigail Date: Sat, 26 Jun 2021 23:51:53 +0200 Subject: More languages in README --- challenge-118/abigail/README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/challenge-118/abigail/README.md b/challenge-118/abigail/README.md index 05677d379c..ba9aad7a0c 100644 --- a/challenge-118/abigail/README.md +++ b/challenge-118/abigail/README.md @@ -62,14 +62,32 @@ Output: 0 as binary representation of 4 is 100 which is NOT Palindrome. ### Solutions * [AWK](awk/ch-2.awk) * [Bash](bash/ch-2.sh) +* [Basic](basic/ch-2.bas) +* [bc](bc/ch-2.bc) +* [Befunge-93](befunge-93/ch-2.bf93) * [C](c/ch-2.c) +* [Cobol](cobol/ch-2.cb) +* [Csh](csh/ch-2.csh) +* [Erlang](erlang/ch-2.erl] +* [Forth](forth/ch-2.fs] +* [Fortran](fortran/ch-2.f90] * [Go](go/ch-2.go) * [Java](java/ch-1.java) * [Lua](lua/ch-2.lua) +* [m4](m4/ch-2.m4] * [Node.js](node/ch-2.js) +* [OCaml](ocaml/ch-2.ml] +* [Pascal](pascal/ch-2.p] * [Perl](perl/ch-2.pl) +* [PHP](php/ch-2.php] +* [PostScript](postscript/ch-2.ps] * [Python](python/ch-2.py) +* [R](r/ch-2.r] +* [Rexx](rexx/ch-2.rexx] * [Ruby](ruby/ch-2.rb) +* [Scheme](scheme/ch-2.scm] +* [sed](sed/ch-2.sed] +* [Tcl](tcl/ch-2.tcl] ### Blog [Adventure of Knight](https://abigail.github.io/HTML/Perl-Weekly-Challenge/week-118-2.html) -- cgit From d9042f20619d9a9072dcfd3a1ba88b8b76457eb2 Mon Sep 17 00:00:00 2001 From: Abigail Date: Sun, 27 Jun 2021 01:27:23 +0200 Subject: Links to blogs --- challenge-118/abigail/blog.txt | 1 + challenge-118/abigail/blog1.txt | 1 + 2 files changed, 2 insertions(+) create mode 100644 challenge-118/abigail/blog.txt create mode 100644 challenge-118/abigail/blog1.txt diff --git a/challenge-118/abigail/blog.txt b/challenge-118/abigail/blog.txt new file mode 100644 index 0000000000..80b7af5f39 --- /dev/null +++ b/challenge-118/abigail/blog.txt @@ -0,0 +1 @@ +https://abigail.github.io/HTML/Perl-Weekly-Challenge/week-118-1.html diff --git a/challenge-118/abigail/blog1.txt b/challenge-118/abigail/blog1.txt new file mode 100644 index 0000000000..f34b88bb1f --- /dev/null +++ b/challenge-118/abigail/blog1.txt @@ -0,0 +1 @@ +https://abigail.github.io/HTML/Perl-Weekly-Challenge/week-118-2.html -- cgit