Lux-AI-Challenge / Lux-Design-S1

Home to the design and engine of the @Lux-AI-Challenge Season 1, hosted on @kaggle
https://lux-ai.org/
Apache License 2.0
897 stars 152 forks source link

annotate.text() in starter kits has wrong parameter order #149

Closed nathanbabcock closed 2 years ago

nathanbabcock commented 2 years ago

Mentioned a month ago in this Kaggle discussion: https://www.kaggle.com/c/lux-ai-2021/discussion/267542

Internally, the Lux AI Design interprets the DEBUG_ANNOTATE_TEXT command as follows:

    /** formatted as dt <x> <y> <message> <fontsize> */
    DEBUG_ANNOTATE_TEXT = 'dt',

Source: src/Game/index.ts:1078

However, the Typescript kit sends the values in the wrong order:

  text: (x1: number, y1: number, message: string, fontsize: number = 16) => {
    return `dt ${x1} ${y1} ${fontsize} '${message}'`
  },

Source: kits/ts/simple/lux/Agent.ts:215

Note the reversal of fontsize and message. Switching these params to the order expected by the internal game logic fixes the issue. Other language kits have the same issue.

nathanbabcock commented 2 years ago

A PR changing the starter kits is linked above ^

The other approach would be to change the parameter order in the Viewer instead. If that's preferable, I'll cancel the PR I created and leave the kits the same. Either way the comment in Game/index.ts should be updated to match the syntax used across the Viewer and the kits.