Weather routing: Difference between revisions
→{{header|Wren}}: Removed some more unused functions and also fixed discrepancy in final duration (thanks Pete Lomax for finding that).
(Added Wren) |
(→{{header|Wren}}: Removed some more unused functions and also fixed discrepancy in final duration (thanks Pete Lomax for finding that).) |
||
Line 455:
=={{header|Wren}}==
{{trans|Julia}}
A reasonably faithful translation though I haven't bothered to split the code up into modules (which would mean separate files in Wren) and have dispensed altogether with
As Wren uses 0-based indexing the points in the minimum path have coordinates one less than those in the Julia results.
Line 533 ⟶ 531:
static asin(d) { rad2Deg(d.asin) }
static atan(x, y) { rad2Deg(x.atan(y)) }
}
Line 752 ⟶ 744:
}
return [min, idx]
}
Line 878 ⟶ 862:
}
}
var startPos = Point2.new(0, 3) // 0-based
Line 906 ⟶ 889:
The route taking the least time found was:
[[0, 3], [0, 4], [1, 5], [2, 6], [3, 6], [4, 6], [5, 6], [6, 6], [7, 5], [7, 4], [8, 3]]
which has duration 4 hours,
</pre>
|