From: Ben Harris Date: Sat, 1 Jun 2024 11:12:27 +0000 (+0100) Subject: 22a: initial position and a debug display X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~bjharris/git?a=commitdiff_plain;h=b539661727c4959cbab7afdfc937353e9cd12f42;p=aoc-2022.git 22a: initial position and a debug display --- diff --git a/22/22a.bqn b/22/22a.bqn index cc04f7b..32abbe8 100644 --- a/22/22a.bqn +++ b/22/22a.bqn @@ -3,4 +3,13 @@ PrepStep←{ 𝕊"L": 'L'; 𝕊"R": 'R'; •ParseFloat 𝕩 } PrepPath←{ PrepStep¨(+`⟨0⟩∾≠˝⍉2↕𝕩∊"LR")⊔𝕩 } Prep←{ ⟨ PrepMap ¯2↓𝕩, PrepPath ¯1⊑𝕩 ⟩ } -•Show Prep •file.Lines ⊑•args +Mark←{map𝕊⟨pos,dir⟩: + ({𝕊⟨0,1⟩:'>';𝕊⟨1,0⟩:'v';𝕊⟨0,¯1⟩:'<';𝕊⟨¯1,0⟩:'^'}dir)⌾(pos⊸⊑) map +} +Main←{𝕊⟨map,path⟩: + pos←⟨0,⊑(⊏map)⊐'.'⟩ + dir←⟨0,1⟩ + map Mark⟨pos,dir⟩ +} + +•Show Main Prep •file.Lines ⊑•args