Spoof game: Difference between revisions

Content added Content deleted
(Added C)
m (→‎{{header|Kotlin}}: Minor layout adjustments.)
Line 199: Line 199:
=={{header|Kotlin}}==
=={{header|Kotlin}}==
This program has a TEST mode. If you set it to true, the number of coins allocated to each player for each round won't be erased after he/she presses ENTER, which allows you to check it is working out the total for the round correctly.
This program has a TEST mode. If you set it to true, the number of coins allocated to each player for each round won't be erased after he/she presses ENTER, which allows you to check it is working out the total for the round correctly.
<lang scala>//Version 1.2.40
<lang scala>// Version 1.2.40


import java.util.Random
import java.util.Random
Line 284: Line 284:
val index2 = remaining.indexOf(n)
val index2 = remaining.indexOf(n)
first = if (index2 < remaining.lastIndex) remaining[index2 + 1]
first = if (index2 < remaining.lastIndex) remaining[index2 + 1]
else remaining[0]
else remaining[0]
round++
round++
}
}