Execute SNUSP: Difference between revisions

Content added Content deleted
(→‎{{header|Kotlin}}: Updated example see https://github.com/dkandalov/rosettacode-kotlin for details)
Line 112: Line 112:
=={{header|Kotlin}}==
=={{header|Kotlin}}==
{{trans|Go}}
{{trans|Go}}
<lang scala>// version 1.1.1
<lang scala>// version 1.1.2


// requires 5 chars (10 bytes) of data store
// requires 5 chars (10 bytes) of data store
Line 141: Line 141:
ipr = r
ipr = r
ipc = i
ipc = i
break@findStart
break@findStart
}
}
}
}
}
}
Line 148: Line 148:
var id = 0
var id = 0
val step = fun() {
val step = fun() {
if (id and 1 == 0)
if (id and 1 == 0)
ipc += 1 - (id and 2)
ipc += 1 - (id and 2)
else
else
ipr += 1 - (id and 2)
ipr += 1 - (id and 2)
}
}

// execute
// execute
while ((ipr in 0 until cs.size) && (ipc in 0 until cs[ipr].length)) {
while ((ipr in 0 until cs.size) && (ipc in 0 until cs[ipr].length)) {