Background: This was built to replace the old CG puzzle search site (https://github.com/eulerscheZahl/CG-Tools) which went dark when Heroku got rid of their free tier in November 2022. The puzzle search is an important tool for players and contributors of Clash of Code. It allows players to find the contribution page for the puzzles after a game – to fix bad test cases / validators, improve problem statements, or just leave feedback in the comment section. This project is an attempt to replace it with something that is hopefully faster and better at finding puzzles. To achieve this we use the excellent open source search engine MeiliSearch to index and search documents. The front-end for the puzzle search is written using the Svelte framework.
If you don't want to install just
, you can also look at the justfile
and run the equivalent commands manually
Before getting started make sure you have the following installed:
- Just (command runner, bit like
make
but more advanced) - Docker (containerization)
- curl (for making http requests)
- jq (for processing JSON files)
- node.js (for developing front-end)
- Python3 (for helper scripts)
just mkdotenv
– creates.env
file with default configuration for developmentjust install-deps build
– installs npm dependencies and builds the frontendjust meili-up
– uses Docker to start MeiliSearch (on http://localhost:7700)- Acquire some clashes for test data:
just get-clashes 52980368bdbd05abdd789a04173b57b0fdea 682102420fbce0fce95e0ee56095ea2b9924
just combine-clashes
– Combine the clashes into a single JSON file (stored indata/clashes.json
)just put-clashes data/clashes.json
When you're done use just meili-down
to shut down the Meili docker container. The data for MeiliSearch will be preserved under meili_data/
for the next time.
To acquire all of the clashes you can follow the instructions in the dedicated section for using the undocumented CodinGame API (scripts/clashfetch.py
may also help in the process).
cd frontend
- Install dependencies:
npm install
- Start developing with
npm run dev
- Build with
npm run build
HTTP POST url: https://www.codingame.com/services/Contribution/getAcceptedContributions
Request body:
["CLASHOFCODE"]
(change to "ALL" to get regular puzzles too)
To make this work you may need to copy headers (cookies) from the request in Firefox dev tools on the codingame site. To craft the request with all the required headers I recommend using Thunder client for VSCode, but Postman or even just curl would also work.
HTTP POST url: https://www.codingame.com/services/Contribution/findContribution
Request body:
["<publicHandle of the clash>", true]
This end point does not seem to require headers (cookies), but if you do provide them you may get extra information that is only accessible to users above a certain level (for example the solution to the problem).