I love Both CodinGame and Scala because they make programming fun.
CodinGame is great and it would be better if I could
- Separate codes into packages and files
- Reuse existing codes
- Generate the required Player file automatically
- Avoid tedious inter-IDE copy/paste
- Unit test the behavior of my Bot
- Control source code versions with Git
- Stay in my favorite IDE Intellij
This kit achieves these goals through a source code Bundler which assembles source codes from different packages and files into a single one. Once we remove the constraint imposing us to code in one file, we can organize codes better and make them more reusable.
With continuous building/running feature in SBT, we can generate the fat Player file as soon as code is modified. Thanks to CodinGame Sync, the generated bundle can be synchronized to the online IDE automatically.
The example Bot Ghost in the Cell ranked 59/3509
overall and 2/50
for Scala language.
- Intellij
- Scala/SBT
- Git
- Chrome
- CodinGame Sync
-
Clone the CodinGame Scala Kit with Git
git clone https://github.com/truelaurel/CodinGame-Scala-Kit.git
-
Import the SBT project in Intellij
-
Open a terminal and fire SBT, hit
~test
to compile and run unit tests continuously -
Open a second terminal and fire SBT, hit
~runMain com.truelaurel.codingame.tool.bundle.BundlerMain GhostInTheCell.scala
to bundle destination file continuously -
Open CodinGame Sync to synchronize Player.scala file continuously to online IDE
Using CodinGame Scala Kit as a git submodule inside your own git depot you can both store your solutions into a private depot, and still use and contribute to this scala kit. All instructions are available within this example project
-
How Bundler works?
The Bundler reads a source file. Recursively, it replaces the import statements by source files found in this project.
By default, the Bundler scans the
Player.scala
file fromsrc
folder and assembles all dependant source codes in a uberPlayer.scala
file undertarget
folder. -
Can I reuse codes from third party?
No, the Bundler only scans source files included in the project.
-
Is Java Supported?
No, the Bundler only inlines imported source codes and doesn't adapt Java code to Scala. If you prefer Java, I strongly recommend Manwe's great Competitive Programming tools.
Let's discuss it in the CodinGame forum!