aqtech-ca / mctreesearch4j

MIT License
7 stars 1 forks source link

Bug: mogoeke connect4 controller failing to find Kotlinx package during runtime #13

Closed larkz closed 3 years ago

larkz commented 3 years ago

Did you see this error at runtime, its missing a kotlinx immutables library, occurs at runtime when we try to run the connect4 class.

Playing Connect 4 as "o" against Computer as "x"
Play as player 1 or 2? 1
Exception in thread "main" java.lang.NoClassDefFoundError: kotlinx/collections/immutable/ExtensionsKt
    at de.magoeke.kotlin.connectfour.controllers.impl.MainController.<init>(MainController.kt:14)
    at ConnectFour.ConnectFourGame.run(ConnectFourGame.kt:27)
    at me.john_.ConnectFourMainKt.main(ConnectFourMain.kt:7)
    at me.john_.ConnectFourMainKt.main(ConnectFourMain.kt)
Caused by: java.lang.ClassNotFoundException: kotlinx.collections.immutable.ExtensionsKt
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 4 more
larkz commented 3 years ago

In order to get this to run, i removed the toImmutableList() method from kotlinx, and just left it

in src/main/kotlin/de/magoeke/kotlin/connectfour/controllers/impl/MainController.kt

private var board = Board((1..boardSize).map { Column(boardSize) })
// private var board = Board((1..boardSize).map { Column(boardSize) }.toImmutableList())

in src/main/kotlin/de/magoeke/kotlin/connectfour/models/Column.kt

val cells = this.cells//.toImmutableList()

Let me know if you find a way to get this working with the original code, there is still an issue with the maven central repository in his POM.xml file in the mageoeke repo.

JunTaoLuo commented 3 years ago

Not going to fix this. We might move to a different implementation since we don't want a 7x7 board anyway.