What is exactly the Referee ? and so Engine?

Hello everyone,

I am very new to Codingame and so after trying a few and read tips on forum, I understand that it would be better having a re-coded local simulation.
I did some searches and see that there is, for example https://github.com/dreignier/cg-brutaltester that give us the layout and we need to adapt the referee.

In the first place I thought the “referee” refer to the engine, but then I read this topic https://www.codingame.com/forum/t/referees-on-older-games/2761/8 and it seems like the referee is something else which help to build the engine.

I am very confuse now. What is exactly the referee that everyone talk about ? and then the engine ?

Thank you all for your answers, it will help me a lot.

The engine is the program running on the Codingame servers to handle the games of a given contest. CG has published a library (and a skeleton) on Github to help people create their own game. The referee is just the part of this engine which encapsulates the logic specific to a given game. The rest could be customized but you can create a proper game by simply downloading the engine and implementing a valid referee for it.

As you can see, the referee is the most interesting part. Since some contests, a link to the official referee is provided in each game description as a kind of reference implementation to explicit (if not clarify) how a game works. Details tend to matter in the end and the description could omit too much information.

Having a referee is also useful when you adopt a simulation approach with your bot. « Simulation » is a broad term here. You could also use a referee to somewhat recreate the whole game at home, comparing various bots (like Brutaltester). In fact, these use cases are common enough (at least among top players) that the referee term was used before official referees were provided. Some players are still spending (too much) time implementing their own referee to have it in another language or just reduce its code size.

As a beginner, you could find all of this a little overwhelming. Don’t forget that you could go a long way into a contest without having to care about these things. Granted, it would be a tad easier if game creators were able to redact rules a bit more clearly than lately or simply stick too less complicate games.


Hi @Aries1
Thank you very much for your answer.

As I understand what you say, the referee is the game’s behaviour (how units move,…) and the engine is the whole program including the rest (receive I/Os, views,…) ?

Is it correct ?

Yep. The engine doesn’t include the client side player (the « view »), but it does produce the reports for each game run on the server. These reports are then stored to be send later on demand to the web player for a replay. In a somewhat sufficiently generic format to be handled in a game agnostic way (not quite sure about this though).

Edit: forget that, the engines does include the client side player (you can test it locally) and it is obviously game agnostic for the same reason (maybe it can be customized to some extent). The statement above is not wrong but it is just how the two parts interact when deployed.

Thank you very much for your answer, it’s clear for me now !!!