Map range: Difference between revisions
Content added Content deleted
Basicgames (talk | contribs) |
m (→{{header|Wren}}: Minor tidy) |
||
Line 3,588: | Line 3,588: | ||
=={{header|Wren}}== |
=={{header|Wren}}== |
||
{{libheader|Wren-fmt}} |
{{libheader|Wren-fmt}} |
||
<syntaxhighlight lang="ecmascript">import "/fmt" for Fmt |
<syntaxhighlight lang="ecmascript">import "./fmt" for Fmt |
||
var mapRange = Fn.new { |a, b, s| b.from + (s - a.from) * (b.to - b.from) / (a.to - a.from) } |
var mapRange = Fn.new { |a, b, s| b.from + (s - a.from) * (b.to - b.from) / (a.to - a.from) } |
||
Line 3,596: | Line 3,596: | ||
for (s in a) { |
for (s in a) { |
||
var t = mapRange.call(a, b, s) |
var t = mapRange.call(a, b, s) |
||
Fmt.print("$2d maps to $ h", s, t) |
|||
System.print("%(Fmt.d(2, s)) maps to %(f)%(t)") |
|||
}</syntaxhighlight> |
}</syntaxhighlight> |
||