aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-001/paulo-custodio/Makefile8
-rw-r--r--challenge-001/paulo-custodio/brainfuck/ch-1.bf1
-rw-r--r--challenge-001/paulo-custodio/brainfuck/ch-1.pl22
-rw-r--r--challenge-001/paulo-custodio/brainfuck/ch-2.bf1
-rw-r--r--challenge-001/paulo-custodio/brainfuck/ch-2.pl36
-rw-r--r--challenge-001/paulo-custodio/t/test-1.yaml5
6 files changed, 68 insertions, 5 deletions
diff --git a/challenge-001/paulo-custodio/Makefile b/challenge-001/paulo-custodio/Makefile
new file mode 100644
index 0000000000..24da326a16
--- /dev/null
+++ b/challenge-001/paulo-custodio/Makefile
@@ -0,0 +1,8 @@
+all: brainfuck/ch-1.bf brainfuck/ch-2.bf
+ perl ../../challenge-001/paulo-custodio/test.pl
+
+brainfuck/ch-1.bf: brainfuck/ch-1.pl
+ perl brainfuck/ch-1.pl > $@
+
+brainfuck/ch-2.bf: brainfuck/ch-2.pl
+ perl brainfuck/ch-2.pl > $@
diff --git a/challenge-001/paulo-custodio/brainfuck/ch-1.bf b/challenge-001/paulo-custodio/brainfuck/ch-1.bf
new file mode 100644
index 0000000000..b1d94a8bb7
--- /dev/null
+++ b/challenge-001/paulo-custodio/brainfuck/ch-1.bf
@@ -0,0 +1 @@
+[-]+++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++++++++++++++++++++++++.[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++++++++++++++++++++++++.[-]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++++++++++++++++++++++++.[-]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.
diff --git a/challenge-001/paulo-custodio/brainfuck/ch-1.pl b/challenge-001/paulo-custodio/brainfuck/ch-1.pl
new file mode 100644
index 0000000000..c9f6754286
--- /dev/null
+++ b/challenge-001/paulo-custodio/brainfuck/ch-1.pl
@@ -0,0 +1,22 @@
+#!/usr/bin/env perl
+
+# Challenge 001
+#
+# Challenge #1
+# Write a script to replace the character ‘e’ with ‘E’ in the string
+# ‘Perl Weekly Challenge’. Also print the number of times the character ‘e’
+# is found in the string.
+
+# Output brainfuck program
+
+use Modern::Perl;
+
+my $s = "Perl Weekly Challenge";
+my $text = ($s =~ tr/e/E/)." ".$s;
+
+for (split //, $text) {
+ print "[-]"; # zero cell
+ print "+" x ord($_); # set cell to ASCII value of character
+ print "."; # output character
+}
+print "\n";
diff --git a/challenge-001/paulo-custodio/brainfuck/ch-2.bf b/challenge-001/paulo-custodio/brainfuck/ch-2.bf
new file mode 100644
index 0000000000..0a252de458
--- /dev/null
+++ b/challenge-001/paulo-custodio/brainfuck/ch-2.bf
@@ -0,0 +1 @@
+[-]+++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++.[-]++++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++.[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++.[-]++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++.[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++.[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++.[-]+++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++.[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++.[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++.[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++.[-]+++++++++++++++++++++++++++++++++++++++++++++++++.[-]+++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++.[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++.[-]+++++++++++++++++++++++++++++++++++++++++++++++++.[-]+++++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++.[-]+++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++.[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++.[-]+++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++.[-]+++++++++++++++++++++++++++++++++++++++++++++++++.[-]+++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++.[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++.[-]+++++++++++++++++++++++++++++++++++++++++++++++++.[-]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++.[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]++++++++++.
diff --git a/challenge-001/paulo-custodio/brainfuck/ch-2.pl b/challenge-001/paulo-custodio/brainfuck/ch-2.pl
new file mode 100644
index 0000000000..7ef784110a
--- /dev/null
+++ b/challenge-001/paulo-custodio/brainfuck/ch-2.pl
@@ -0,0 +1,36 @@
+#!/usr/bin/env perl
+
+# Challenge 001
+#
+# Challenge #2
+# Write a one-liner to solve the FizzBuzz problem and print the numbers 1
+# through 20. However, any number divisible by 3 should be replaced by the word
+# ‘fizz’ and any divisible by 5 by the word ‘buzz’. Those numbers that are both
+# divisible by 3 and 5 become ‘fizzbuzz’.
+
+# Output brainfuck program
+
+use Modern::Perl;
+
+my $text = "";
+for my $n (1..20) {
+ if ($n%15==0) {
+ $text .= "fizzbuzz\n";
+ }
+ elsif ($n%3==0) {
+ $text .= "fizz\n";
+ }
+ elsif ($n%5==0) {
+ $text .= "buzz\n";
+ }
+ else {
+ $text .= "$n\n";
+ }
+}
+
+for (split //, $text) {
+ print "[-]"; # zero cell
+ print "+" x ord($_); # set cell to ASCII value of character
+ print "."; # output character
+}
+print "\n";
diff --git a/challenge-001/paulo-custodio/t/test-1.yaml b/challenge-001/paulo-custodio/t/test-1.yaml
index c36262e3b7..2c3894252e 100644
--- a/challenge-001/paulo-custodio/t/test-1.yaml
+++ b/challenge-001/paulo-custodio/t/test-1.yaml
@@ -3,8 +3,3 @@
args: Perl Weekly Challenge
input:
output: 5 PErl WEEkly ChallEngE
-- setup:
- cleanup:
- args: Champion
- input:
- output: 0 Champion