@verb #8433:"tell_WWW_page" this none this rxdo #9682 @program #8433:"tell_WWW_page" this none this player:tell("
| Athletes | ", athletes, " | Countries | ", countries, " |
| ", y[1], " | ") for z in (y[2]) player:tell(z[1], " / ") endfor player:tell(" | ||
")
medals = {"Gold", "Silver", "Bronze"}
values = {10, 5, 1}
for foo in (events)
medal = 1
while (medal < 4)
winners = random(5) == 1 ? random(2) | 1
names = {"foo"}
for x in [1..winners]
"pick a winning country"
name = "foo"
while (name in names)
country = random(length(countries))
athlete = random(length(countries[country][2]))
name = countries[country][2][athlete][1]
endwhile
names = {@names, name}
countries[country][3] = countries[country][3] + values[medal]
countries[country][2][athlete][2] = {@countries[country][2][athlete][2], foo}
countries[country][2][athlete][3] = countries[country][2][athlete][3] + values[medal]
player:tell(tostr(medals[medal], " ", foo, " = ", name))
endfor
medal = medal + winners
endwhile
endfor
player:tell("athletes.txt file")
for country in (countries)
for athlete in (country[2])
player:tell(athlete[1])
player:tell(country[1])
player:tell(length(athlete[2]))
for event in (athlete[2])
player:tell(event)
endfor
endfor
endfor
player:tell("Expected output")
sorted = $list_utils:sort_alist(countries, 3)
for x in [0..length(sorted) - 1]
realpos = length(sorted) - x
player:tell(x + 1, ". ", sorted[realpos][1], " ", sorted[realpos][3], " points")
endfor
player:tell("")
"Last modified by Dax (#789) on Tue May 3 14:09:37 2005 MDT."
.