amaatouq/netwise

Add bots

Closed this issue · 6 comments

TBD. But overall, in a /game/bots forder, have multiple bot implementation (alice, bob...). A bot has callbacks, get the same data and functions as UI, with the current player.

two examples of bot behaviors:

  • Bot Alice:
    • pick the correct answer + noise around it (can be Gaussian or uniform). The answer after adding the nose must be between 0 and 1
    • update the answer in the interactive stage to the mean of the neighbors (including her own guess in computing the average)
    • follow random 'game.treatment.alterCount' people in the round outcome
  • Bot Bob:
    • pick a random answer for the initial stage
    • update the answer in the interactive stage to be the weighted average of the alters (including his). Weights based on performance (will require normalization so the weights add up to one).
    • follow top 'game.treatment.alterCount' people in the round outcome based on the current round's score

There's a PR (#38) with a very early implementation of bots. It is not integrated with the lobby, but with the a new condition botsCount. If that's how we want to do it, probably not, we might want more knobs on this, but it's just to show it working. I also only implemented one callback onStageTick, which is called once per second during the whole game pretty much. It's quite straight forward.

in the bot onStageTick the game.treatment is undefined.

it seems that all the game attributes in the bot are undefined (i.e., game.players). Also, bot.get("alterIds") is undefined.

game.treatment and bot.get() should work now.

Ok .. it seems to be working!