diff options
| author | Conor Hoekstra <codereport@outlook.com> | 2024-08-05 17:06:25 -0400 |
|---|---|---|
| committer | Conor Hoekstra <codereport@outlook.com> | 2024-08-05 17:06:25 -0400 |
| commit | 93a8115c85650e76505f7cb610b3a31cc61388c1 (patch) | |
| tree | 53a2597941fb8af2ec6814efa9cea10eaf636d8b /challenge-281/conor-hoekstra | |
| parent | 524012f041fc882afc4b0aeda4e1bffae33d7ae7 (diff) | |
| download | perlweeklychallenge-club-93a8115c85650e76505f7cb610b3a31cc61388c1.tar.gz perlweeklychallenge-club-93a8115c85650e76505f7cb610b3a31cc61388c1.tar.bz2 perlweeklychallenge-club-93a8115c85650e76505f7cb610b3a31cc61388c1.zip | |
:sparkles: Week 281 in BQN
Diffstat (limited to 'challenge-281/conor-hoekstra')
| -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 |
