Reinventing wheels?

Jump to navigation Jump to search
Revision as of 28 February 2019 at 07:21.
This is the thread's initial revision.

Reinventing wheels?

Although the sample code implemented tick synchronization between worker thread and robot thread, the use of token may not be necessary, since Java already had similar mechanism.

    worker = new Thread(() -> {
      try {
        while (true) {
      } catch (InterruptedException e) {

call worker.interrupt() whenever you don't need it anymore, or just wait robocode to call that method for you.

    Xor (talk)08:21, 28 February 2019