RosettaCodeData/Task/Maximum-triangle-path-sum/Picat/maximum-triangle-path-sum-2.picat
2023-07-01 13:44:08 -04:00

10 lines
238 B
Text

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.