diff options
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/fifty.bqn | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/examples/fifty.bqn b/examples/fifty.bqn index c3c76a76..b43a6b65 100644 --- a/examples/fifty.bqn +++ b/examples/fifty.bqn @@ -110,7 +110,7 @@ IndexFromPermutation‿PermutationFromIndex ← { Ifp‿Pfi } ! { - p ← 1‿3‿0‿7‿6‿5‿4‿9‿8‿2 + p ← 1‿3‿0‿7‿6‿5‿4‿9‿8‿2 p ≡ 10 PermutationFromIndex i ← IndexFromPermutation p p ≡ ⊢⌾(10⊸IndexFromPermutation) p i ≡ ⊢⌾(10⊸PermutationFromIndex) i @@ -154,20 +154,20 @@ NQueens ← { QueenCheck ← { ! 1=≠≢𝕩 ! (↕≠𝕩)≡∧𝕩 - ! ((2⥊≠𝕩)⥊1)≡(=⌜˜↕≠𝕩)≥(|-⌜˜𝕩)=|-⌜˜↕≠𝕩 + ! ∧´⥊(=⌜˜↕≠𝕩)≥(|-⌜˜𝕩)=|-⌜˜↕≠𝕩 } QueenCheck˘ NQueens 8 -#26 +# 26 KnightsTour ← { Kmoves ← { t ← (⥊↕𝕩‿𝕩)+⌜<˘8‿2⥊2‿1‿2‿¯1‿1‿2‿1‿¯2‿¯1‿2‿¯1‿¯2‿¯2‿1‿¯2‿¯1 - (∧´⎉1(>t)∊↕𝕩) /¨○<˘ 𝕩{+⟜(𝕨⊸×)´⌽𝕩}¨t + (∧˝⎉1(>t)∊↕𝕩) /¨○<˘ 𝕩{+⟜(𝕨⊸×)´⌽𝕩}¨t } m ← >↑˜¨⟜(⌈´≠¨) Kmoves 𝕩 b ← (𝕩×𝕩)⥊1 - F ← {b↩0⌾((¯1⊑𝕩)⊸⊑)b ⋄ 𝕩∾(⊑⍋+´˘(j⊏m)⊏b)⊑j←⊏⟜b⊸/(¯1⊑𝕩)⊏m} - 𝕩‿𝕩⥊⍋F⍟(¯1+𝕩⋆2) 1⥊0 + F ← {b↩0⌾(𝕩⊸⊑)b ⋄ (⊑⍋+˝˘(j⊏m)⊏b)⊑j←⊏⟜b⊸/𝕩⊏m} + 𝕩‿𝕩⥊⍋F⍟(↕𝕩⋆2) 0 } ! (KnightsTour 6) ≡ 6‿6⥊0‿9‿20‿35‿6‿11‿21‿32‿7‿10‿19‿26‿8‿1‿34‿25‿12‿5‿33‿22‿31‿16‿27‿18‿2‿15‿24‿29‿4‿13‿23‿30‿3‿14‿17‿28 |
