Cg-brutaltester, because you love to be brutal

No problem, I wanted to do that and submit a PR, but couldn’t figure out a clean way to set it (as you can see they call System.getProperty every time)…

While we’re on the subject of updating UTTT referee, maybe change timeout to 1000ms globally as it seemed to crash for me with default 100ms (even though bot itself has strict 95ms limit).

I had to change this for the logs:

--- a/src/main/java/com/magusgeek/brutaltester/
+++ b/src/main/java/com/magusgeek/brutaltester/
@@ -47,7 +47,7 @@ public class GameThread extends Thread {

                if (logs != null) {
-                       command[playersCount * 2 + 2] = "-l";
+                       command[splitted.length + playersCount * 2] = "-l";

Oh yes i forgot to test logs with new referees :smiley:

Hi Magus,
I’ve updated game-ultimate-tictactoe and cg-brutaltester from your github and still have ‘Negative score during game 1’ running with
C:\Programs\JDK8\bin\java.exe -jar C:\Projects\cg-brutaltester\target\cg-brutaltester-1.0.0-SNAPSHOT.jar -r "java -jar C:\Projects\game-ultimate-tictactoe\target\tictactoe-1.0-SNAPSHOT.jar" -p1 test_p1.bat -p2 test_p2.bat -t 1 -n 1
I’ve also tried to pass -Dleague.level=2 to referee java call, but it doesn’t change anything. Is there something else that should be done?

First, don’t forget the -Dleague.level=2 in the referee command line.

Second, if you are on windows like me, the codingame SDK got a big problem to measure time. So most of the time the game is finished with a timeout at first round …

To avoid that i changed the timeouts constants in the referee. Just replace them with a very big number :smiley:

I’m having almost the same issue using cg-brutaltester for the first time on the current contest Code of Kutulu.
I program in Groovy

java -jar cg-brutaltester.jar -r "java -jar cok-referee.jar" -p1 "src/CodeOfKutulu.groovy" -p2 "src/CodeOfKutulu.groovy" -p3 "src/CodeOfKutulu.groovy" -p4 "src/CodeOfKutulu.groovy" -n 1 -v

21:11:00,257 INFO [com.magusgeek.brutaltester.Main] Verbose mode activated
21:11:00,258 INFO [com.magusgeek.brutaltester.Main] Referee command line: java -jar cok-referee.jar
21:11:00,259 INFO [com.magusgeek.brutaltester.Main] Player 1 command line: src/CodeOfKutulu.groovy
21:11:00,260 INFO [com.magusgeek.brutaltester.Main] Player 2 command line: src/CodeOfKutulu.groovy
21:11:00,261 INFO [com.magusgeek.brutaltester.Main] Player 3 command line: src/CodeOfKutulu.groovy
21:11:00,261 INFO [com.magusgeek.brutaltester.Main] Player 4 command line: src/CodeOfKutulu.groovy
21:11:00,261 INFO [com.magusgeek.brutaltester.Main] Number of games to play: 1
21:11:00,264 INFO [com.magusgeek.brutaltester.Main] Number of threads to spawn: 1
21:11:00,364 ERROR [com.magusgeek.brutaltester.GameThread] Exception in game 1
at java.util.Scanner.throwFor( ~[?:1.8.0_112]
at ~[?:1.8.0_112]
at java.util.Scanner.nextInt( ~[?:1.8.0_112]
at java.util.Scanner.nextInt( ~[?:1.8.0_112]
at [cg-brutaltester.jar:?]
21:11:00,369 ERROR [com.magusgeek.brutaltester.GameThread] If you want to replay and see this game, use the following command line:
21:11:00,371 ERROR [com.magusgeek.brutaltester.GameThread] java -jar cok-referee.jar -p1 src/CodeOfKutulu.groovy -p2 src/CodeOfKutulu.groovy -p3 src/CodeOfKutulu.groovy -p4 src/CodeOfKutulu.groovy -s
21:11:00,372 INFO [com.magusgeek.brutaltester.Main] *** End of games ***
| Results | Player 1 | Player 2 | Player 3 | Player 4 |
| Player 1 | | NaN% | NaN% | NaN% |
| Player 2 | NaN% | | NaN% | NaN% |
| Player 3 | NaN% | NaN% | | NaN% |
| Player 4 | NaN% | NaN% | NaN% | |

The bot works fine in the online CodinGame IDE.
I tried using the following in the beginning:


but that didn’t help. :neutral_face:
Any idea how to fix this?

Edit: Tried using only Players from the tests here

java -jar cg-brutaltester.jar -r "java -jar cok-referee.jar" -p1 "" -p2 "" -p3 "" -p4 ""

but same error

I managed to alter Code of Kutulu referee to run it with Cg-brutaltester. Not sure on the moral aspect of sharing the code during the contest (I can put it to github if some admin or Magus says its ok), but I can offer some clues that might be useful also for future contests:

  1. Get the game running locally using the referee only with the CommandLineInterface from Cg-brutaltester.
  • Start by applying the steps on
  • You can start with some test players if they are provided in tests for referee code.
  • Changing the logging level to ‘trace’ helps for debugging ("rootLogger.level = trace" in of referee). You might want to revert it once it runs fine.
  • Some method/class names can change comparing to tictactoe in . Download it and compare.
  • The lack of stdout flushing of players is a thing to look out for. For python -u option is enough, e.g. python -u
  • Before trying to run Cg-brutaltester make sure you can run referee with and without -s. E.g. for CoK this should work (depending on your path to test classes):
    java -jar codeOfKutulu-1.0.jar -p1 "java -cp . runner.tests.random.Player" -p2 "java -cp . runner.tests.random.Player" -p3 "java -cp . runner.tests.uselight.Player" -p4 "java -cp . runner.tests.yell.Player" -l ./logs/game1.json -s
    Without -s it should give you the final score and seed only.
  1. Then it should work with Cg-Brutaltester :slight_smile:

I’m not a Java guy, but I was able to that without any Java IDE, just had to get maven to build the packages (go into the directory with pom.xml and run mvn package) and change a name here and there.

As input to -p1, p2… you should provide a string that can be used to create a process. For groovy I guess it would be groovy src/CoK.groovy and for java you have to compile it into .class files and then run like java -cp . Waiter (mind the classpath).