Kotlin support

Hi everyone

Not sur if it’s the good place to share this, if not can you tell me where is it !

I am newbie but I made some work on a Gradle script to rebuild all kotlin file into a single one.
For what I need It work pretty well.
I use it like this

$ ./gradlew :module_name: buildSingleFile

The file is written in

module_name/build/codingame/codingame.kt

If you have some tips or improvement don’t be shy and share it !!

Best

1 Like

Is it possible to update from version 1.1 to version 1.2?

Thanks

5 Likes

Just wanted to ask if this update is planned soon - depending on that I take the next contest with that language.

Version 1.2 really fixes a lot of library functions and stuff I use a lot - without it programming IS very different. Updating the language should be really easy for you guys. And bring on more new people to this platform who interested in learning new languages.

3 Likes

Is there any update on when Kotlin 1.2 will be introduced? Although I haven’t had much chance to play around on CodinGame with Kotlin yet, I’d greatly appreciate the continued support :slight_smile:

Also waiting for 1.2 here, I’m very much used to the new stdlib features already :confused:

same… and 1.3 is coming…

When we did the last languages update this summer, we contacted the Kotlin team because we needed their help. They didn’t reply right away so we couldn’t update.
Now that Kotlin Native is public, we won’t need their specific support each time we want to update. https://kotlinlang.org/docs/reference/native-overview.html

But our installation is a bit different, we’ll need a bit of time to update. We’ll do it as soon as we have some time.

2 Likes

btw it seems https://www.codingame.com/faq is not showing which target & lib you use for kotlin (I thought it was jre target… but it seems you are using native).the lib probably is kotlin-stdlib. can you add these informations on faq page ?

maybe you could also specify kotlin native version you use.

when is next languages update ?

we do an update of languages every 6 months or so. Since we couldn’t update Kotlin last summer, I think the dev team will take care of it before the next update. I’ll ask them to put the complete info in the FAQ

Great news! Thanks for the info. Looking forward to using an updated version :slight_smile:

btw its not kotlin native (System.in everywhere :stuck_out_tongue:)

So how’s the update coming on? Kotlin 1.1.50 is really old now. Even all the 1.2 versions are obsolete now that 1.3.0 is out. Time for an upgrade, please?

Kotlin has been updated! Now using v 1.3 (FAQ not yet updated)
@Speekha

3 Likes

There’s a bug in the current Kotlin build which is preventing me from doing nested arrays. The issue appears to be compiler or OS dependent.

https://youtrack.jetbrains.com/issue/KT-28285

The issue can be reproduced with the following code in any of the current puzzles.

fun main(args: Array<String>) {
    val board = Array(10, { IntArray(10) })
}

Would it be possible to revert the version of Kotlin until this is fixed? Thanks.

A current workaround is to do something like this, which isn’t too bad if we want to wait until the YouTrack issue is resolved.

val board = ArrayList<IntArray>(width)
for (i in 0 until width) {
    board.add(IntArray(height))
}

It’s actually very bad in the context of CG where performance matters a lot.
Because of that bug you basically cannot use the Array constructor (but IntArray still works though).

The only passable workaround that I found is to do something like:
val array = arrayOfNulls<IntArray>(10)

It’s not ideal because then you have to deal with the fact that kotlin thinks stuff is nullable all over your code, but at least you don’t have to use lists which should always be avoided for performance reasons.

We are working on it. Just need to deploy the fix suggested by the Kotlin team.

Hello guys, this is fixed now. We implemented the workaround for https://youtrack.jetbrains.com/issue/KT-28285

3 Likes

Hello all,

I came back after a few years and resolved some puzzles using Kotlin. I was surprised by the really poor performance of the environment.

Launching the smallest program takes at least 12 seconds.
To be compared to 2 seconds in java, and less than a second in javascript.

Is there any explaination/optimization for this environment?