Horse racing: Difference between revisions

→‎{{header|Wren}}: Can now deal with a multiple dead-heat.
m (Minor tweaks.)
(→‎{{header|Wren}}: Can now deal with a multiple dead-heat.)
Line 130:
System.print("Pos Horse Weight Dist Sex")
var p = 1
var pos = ""
for (x in 0...l.count) {
var wt = l[x].value[1] ? "9.00" : "8.11"
var dist = 0
if (p > 1) dist = (l[x-1].value[0] - l[x].value[0]) * 0.5
var pos = (p == 1 || dist > 0) ? p.toString : (!pos.endsWith("=") ? (p - 1).toString + "=" : pos)
var sx = l[x].value[1] ? "colt" : "filly"
Fmt.print("$-2s $s $s $3.1f $s", pos, l[x].key, wt, dist, sx)
9,482

edits