World Cup group stage: Difference between revisions
Content added Content deleted
Line 216: | Line 216: | ||
{{trans|Java}} |
{{trans|Java}} |
||
ELENA 3.4 : |
ELENA 3.4 : |
||
<lang elena>import system'routines |
<lang elena>import system'routines; |
||
import extensions |
import extensions; |
||
public |
public singleton program |
||
{ |
{ |
||
static games := |
static games := new string[]{"12", "13", "14", "23", "24", "34"}; |
||
static results := "000000" |
static results := "000000"; |
||
nextResult |
nextResult() |
||
{ |
|||
if (results=="222222") |
if (results=="222222") { ^ false }; |
||
results := (results |
results := (results.toInt(3) + 1).toString(3).padLeft($48, 6); |
||
^ true |
^ true |
||
} |
|||
closure |
closure() |
||
{ |
|||
var points := |
var points := new IntMatrix(4, 10); |
||
doUntil(program.nextResult().Inverted) |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
{ |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
records := records.ascendant(); |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
for(int i := 0, i <= 3, i += 1) { points[i][records[i]] += 1 } |
|||
⚫ | |||
⚫ | |||
0 to:3 do(:i)[ (points[i][records[i]]) += 1 ]. |
|||
⚫ | |||
⚫ | |||
] repeatWhile:$(self nextResult). |
|||
}); |
|||
} |
|||
⚫ | |||
⚫ | |||
⚫ | |||
arrayConvertorEx convert(points[3 - i]). |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
{{out}} |
{{out}} |
||
<pre> |
<pre> |