Horse racing: Difference between revisions

→‎{{header|Wren}}: Eliminated a variable.
(→‎{{header|Wren}}: Can now deal with a multiple dead-heat.)
(→‎{{header|Wren}}: Eliminated a variable.)
Line 129:
System.print("Race 4\n")
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 (px > 10) dist = (l[x-1].value[0] - l[x].value[0]) * 0.5
pos = (px == 10 || dist > 0) ? p(x+1).toString : (!pos.endsWith("=") ? (p - 1)x.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)
p = p + 1
}
 
9,477

edits