diff options
| -rw-r--r-- | challenge-281/conor-hoekstra/ch-1.bqn | 10 | ||||
| -rw-r--r-- | challenge-281/conor-hoekstra/ch-2.bqn | 16 |
2 files changed, 26 insertions, 0 deletions
diff --git a/challenge-281/conor-hoekstra/ch-1.bqn b/challenge-281/conor-hoekstra/ch-1.bqn new file mode 100644 index 0000000000..3b0feeb2b6 --- /dev/null +++ b/challenge-281/conor-hoekstra/ch-1.bqn @@ -0,0 +1,10 @@ +# For up to date code: +# https://github.com/codereport/bqn-code/blob/main/pwc/281-1.bqn + +IsDark ← 2|·+´48|-⟜'0'¨ + +# Tests +•Show IsDark "d3" # 1 +•Show IsDark "g5" # 0 +•Show IsDark "e6" # 1 +•Show IsDark "a1" # 0 diff --git a/challenge-281/conor-hoekstra/ch-2.bqn b/challenge-281/conor-hoekstra/ch-2.bqn new file mode 100644 index 0000000000..4289be1dab --- /dev/null +++ b/challenge-281/conor-hoekstra/ch-2.bqn @@ -0,0 +1,16 @@ +# For up to date code: +# https://github.com/codereport/bqn-code/blob/main/pwc/281-2.bqn + +Convert ← 48|-⟜'0'¨ +deltas ← (⌽¨⊸∾)∾<˘2‿¯2⋈⌜1‿¯1 +IsValid ← ∧´1⊸≤∧8⊸≥ +Moves ← {IsValid¨⊸/⥊𝕩+⌜deltas} + +MinKnightMoves ← { + end‿start ← 𝕨 ⋈○Convert 𝕩 + 1 end { ∨´𝕗⊸≡¨Moves 𝕩 ? 𝕨 ; (𝕨+1) 𝕊 Moves 𝕩 } ⟨start⟩ +} + +# Tests +•Show "g2" MinKnightMoves "a8" # 4 +•Show "g2" MinKnightMoves "h2" # 3 |
