RosettaCodeData/Task/Maximum-triangle-path-sum/Picat/maximum-triangle-path-sum-2.picat

11 lines
238 B
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
pp2(Row, Column, Sum, Tri, M) =>
if Sum > M.get(max_val,0) then
M.put(max_val,Sum)
end,
Row := Row + 1,
if Row <= Tri.length then
foreach(I in 0..1)
pp2(Row,Column+I, Sum+Tri[Row,Column+I], Tri, M)
end
end.