I'm trying advent of code, day 19 and I'm running into a strange error
which occurs in both j903 and j904.

I'll probably try simplifying this into something which isolates the
problem more compactly, tomorrow.

sample=: {{)n
Blueprint 1:
  Each ore robot costs 4 ore.
  Each clay robot costs 2 ore.
  Each obsidian robot costs 3 ore and 14 clay.
  Each geode robot costs 2 ore and 7 obsidian.

Blueprint 2:
  Each ore robot costs 2 ore.
  Each clay robot costs 3 ore.
  Each obsidian robot costs 3 ore and 8 clay.
  Each geode robot costs 3 ore and 12 obsidian.
}}


costmat=: 0 1|:".>cutLF;._2{{)n
  0 0 0 0 0 1 0
  0 0 0 0 0 0 0
  0 0 0 0 0 0 0
  0 0 0 0 0 0 1

  0 0 0 1 0 0 0
  0 0 0 0 0 0 0
  0 0 0 0 0 0 0
  0 0 0 0 1 0 0

  0 0 1 0 0 0 0
  0 0 0 0 0 0 0
  0 0 0 0 0 0 0
  0 0 0 0 0 0 0

  0 1 0 0 0 0 0
  0 0 0 0 0 0 0
  0 0 0 0 0 0 0
  0 0 0 0 0 0 0

}}rplc LF2;LF,';'

num=: 0 ". ([-.-.)&(~.'-',":i.10)
parse=:  costmat +/ .*~ num;._1

bot0=:24 4$4{.1
addbot=: {{
  echo 'm';m
  echo 'y';y
  echo 'typ';typ=: 1 i.~ +./t=.y */ .>:"1/m
  echo 'min';min=: 1 i.~ typ=.{|:t
  x+([echo@<)(min<:i.24)*/typ=i._4
}}

When I run

   bot0 ({.parse sample) addbot +/\bot0

I'm expecting some 1s in the second column of the result. Those do not
appear and the final echo is reporting a result of all zeros. And yet,
when I run the expression
   (min<:i.24)*/typ=i._4

immediately after that prior expression, I get 1s in the second column.

Anyways... the code here is ugly, but so is this behavior. I think.

Hopefully, this isn't also because I goofed in some tremendously
obvious fashion.

For now, I should probably just get some sleep...

-- 
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to