CodinGame C++ Framework

Hey folks!

When I started out working on puzzles I noticed that there were a few things that I kept doing for every puzzle:

  • Create the initial puzzle file/project and adding them to my solution
  • Writing the input parsing/logging code
  • Copy/pasting common code from other puzzles
  • Copying the outputs from the CodinGame IDE locally and just keeping the relevant outputs so that I use them as inputs to debug my code locally

I’ve worked on a framework that solves all those problems for me so I thought I’d share it here in hopes that someone else will make use of it :slight_smile:

I called it CodinGame C++ Framework, CGF for short. As of this post it can do the following:

  • Generates puzzle boilerplate code: Provide a puzzle name and it’ll generate the initial files for you
    • Includes the pragma for optimizing C++ code :stuck_out_tongue:
  • Input parsing code generation: automatically generates the input parsing and logging code from a class definition
    • The generated classes can be extended with custom code as well as optionally override the input parsing/logging code if needed
    • Classes are defined in C# with custom attributes to direct the code generator
  • Project/Solution generation: automatically generates projects/solutions, with one project for each puzzle and one for all the common code
  • Merge many files to one: merges code from multiple files into one file for submission to CodinGame
  • Generate local input from CodinGame output: comes with a tool to parse the inputs from a copy of the CodinGame console window
    • Just copy the whole thing, paste it in a file, run the tool and you’ll have a file ready for local debugging
  • Integrates Dear ImGui: to easily visualize your algorithms
  • Productivity scripts: has a bunch of script files to help with doing the above quickly.

You can find the project here: It also comes with the solution to 2 easy puzzles, Onboarding and AsciiArt, to show how to use the framework. The documentation comes with steps on how to solve your first puzzle, instructions on how to solve Onboarding and AsciiArt with the framework, and a more detailed documentation of what the framework does and how.

In its current state it’s been working really well for me. If anyone tries it and has any feedback please let me know, I’d love to hear it!