This extension gathers some tools I use to develop more easily bots for CodinGame. The priorities of this extension are to satisfy my current needs while being simple. As a result, the extension is not very flexible or customizable.
You can read more about this extension and how to use it in this article on my blog.
Keep in mind that this extension is the first I write. Also, I never programmed in TypeScript before. Thus, there might be silly things I do here that make you want to pull your hair.
If you have any feature or improvement suggestions or want to participate in the development, let me know!
1. Features
Create a new C++ bot project from a starter folder. The starter folder is expected to respect these rules:
CMakeLists.txt
at its root to build the project. This CMakeLists.txt must honor the following variables
package
folder. Remember that the CodinGame platform requires the bots to fit in a single file. The current bot version is in package/bot.cpp
,CMakeLists.txt
must ensure the file PreviousBotVersions.cmake
exists and include it.I provide a working example of starter C++ CodinGame project in another repository.
Configure the build a bot, choosing its build type among Dev, Release, and Debug. Once the configuration is done, you can press CTRL+SHIFT+B
to build the project, if you used my starter C++ CodinGame project. You will also have symbol indexing, allowing you to navigate to symbols definitions or declarations, open headers, rename variables, find references, and so on.
Open a bot project store in a folder inside the root directory of your CodinGame projects. The command is case insensitive, so if you have a bot project named MyBot
, you can simply request the project for mybot
.
Save the current version of the bot, i.e. the file package/bot.cpp
, in a new file in the package
folder. The new file is added the PreviousBotVersions.cmake
in order to be compiled.
For this extension to behave as expected, you need to have the following tools installed:
cmake
to generate a build configuration for your projects,ninja
to build your projects; this generator is fast and provides compile_commands.json
which is used by IntelliSense,compdb
to extend the compile_commands.json
file with headers, in order to improve the indexing done by IntelliSenseclang
to perform the indexing done by IntelliSense.The starter C++ project I provide also requires python
to execute a script that merge multiple source files into one file. It also contains a .editorconfig
that could be recognized by the EditorConfig for VS Code extension.
This extension contributes the following settings:
codinGame.rootPath
: set it to the root directory of your CodinGame projects.codinGame.includePath
: set it to the folder path containing common headers you use in your bots and tools. If not defined, it will be codinGame.rootPath/tools/include
.codinGame.libPath
: set it to the folder path containing common libraries you use in your tools. If not defined, it will be codinGame.rootPath/tools/lib
.codinGame.starterPath
: set it to the folder path containing an initial configuration for a bot. If not defined, it will be codingGame.rootPath/tools/starter
codinGame.cmakeExtra
: extra arguments that are passed to CMake
when configuring the buildcodinGame.cCompilerPath
: path to the C compiler to use to compile bots. If not defined, CMake
will decide itself.codinGame.cppCompilerPath
: path to the C++ compiler to use to compile bots. If not defined, CMake
will decide itself.CPPCompilerPath
CCompilerPath
cmakeExtra
PreviousBotVersions.cmake
filerootPath
, includePath
, libPath
, and starterPath
that are used to create and configure a botgamerPassword
and gamerEmail
to connect to a CodinGame accountgameId
and isMulti
that are used to send a bot to CodinGame