aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad Sajid Anwar <Mohammad.Anwar@yahoo.com>2024-09-09 22:50:29 +0100
committerGitHub <noreply@github.com>2024-09-09 22:50:29 +0100
commit78501a1a799fb0f93e30e70ae0c8e18ea0eaf83c (patch)
tree39657e7d106327e75cf7f8eaa30f86115432b241
parent8abd0fdac9d883bb40a4f769a52c2dc42fd95fde (diff)
parent89c7b56c0379e648b759a600b703ec6c334de748 (diff)
downloadperlweeklychallenge-club-78501a1a799fb0f93e30e70ae0c8e18ea0eaf83c.tar.gz
perlweeklychallenge-club-78501a1a799fb0f93e30e70ae0c8e18ea0eaf83c.tar.bz2
perlweeklychallenge-club-78501a1a799fb0f93e30e70ae0c8e18ea0eaf83c.zip
Merge pull request #10810 from codereport/master
:sparkles: PWC 285-1 in BQN
-rw-r--r--challenge-285/conor-hoekstra/ch-1.bqn14
-rw-r--r--challenge-286/conor-hoekstra/ch-1.bqn6
-rw-r--r--challenge-286/conor-hoekstra/ch-2.bqn10
3 files changed, 30 insertions, 0 deletions
diff --git a/challenge-285/conor-hoekstra/ch-1.bqn b/challenge-285/conor-hoekstra/ch-1.bqn
new file mode 100644
index 0000000000..f2e7cd2fd3
--- /dev/null
+++ b/challenge-285/conor-hoekstra/ch-1.bqn
@@ -0,0 +1,14 @@
+# For up to date code:
+# https://github.com/codereport/bqn-code/blob/main/pwc/285-1.bqn
+
+DeadEnds ← ⊢´¨(¬∘∊/⊣)⊑¨
+ # (↑¨↓¨)«~»(↑¨) - Kap (original)
+ # ⊢/¨«~»(↑¨) - Kap
+ # ⊢/¨~⊃¨ - Dyalog APL
+ # {⊃~/⌽↓⍉↑⍵} - Dyalog APL (Alternative)
+ # Ṫ€ḟḢ€ - Jelly
+ # ↓¨~↑¨ - Hypothetical APL
+
+# Tests
+•Show DeadEnds ⟨⟨"B","C"⟩, ⟨"D","B"⟩, ⟨"C","A"⟩⟩ # "A"
+•Show DeadEnds ⟨⟨"A","Z"⟩⟩ # "Z"
diff --git a/challenge-286/conor-hoekstra/ch-1.bqn b/challenge-286/conor-hoekstra/ch-1.bqn
new file mode 100644
index 0000000000..e4b86c7de8
--- /dev/null
+++ b/challenge-286/conor-hoekstra/ch-1.bqn
@@ -0,0 +1,6 @@
+# For up to date code:
+# https://github.com/codereport/bqn-code/blob/main/pwc/286-1.bqn
+
+⟨Split⟩ ⇐ •Import "../lib/string.bqn"
+
+•Out (•rand.Range∘≠⊸⊑) ' ' Split ∾´ •file.Lines "286-1.bqn"
diff --git a/challenge-286/conor-hoekstra/ch-2.bqn b/challenge-286/conor-hoekstra/ch-2.bqn
new file mode 100644
index 0000000000..d572e07af0
--- /dev/null
+++ b/challenge-286/conor-hoekstra/ch-2.bqn
@@ -0,0 +1,10 @@
+# For up to date code:
+# https://github.com/codereport/bqn-code/blob/main/pwc/286-2.bqn
+
+OrderGame ← { 1=≠𝕩 ? ⊑𝕩 ; 𝕊 •Show ((2÷˜≠𝕩)⥊⟨⌊´,⌈´⟩) {𝕎𝕩}¨ <˘∘‿2⥊𝕩 }
+
+# Tests
+# Example 1
+•Show OrderGame ⟨2, 1, 4, 5, 6, 3, 0, 2⟩ # 1
+•Show OrderGame ⟨0, 5, 3, 2⟩ # 0
+•Show OrderGame ⟨9, 2, 1, 4, 5, 6, 0, 7, 3, 1, 3, 5, 7, 9, 0, 8⟩ # 2