Skip to content

Instantly share code, notes, and snippets.

@SpicyKitten
Created October 28, 2019 00:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SpicyKitten/3dcc9463f47626a217a5a51762f02fe6 to your computer and use it in GitHub Desktop.
Save SpicyKitten/3dcc9463f47626a217a5a51762f02fe6 to your computer and use it in GitHub Desktop.
const turn = api.turn();
if (turn === 0) {
this.generator = (function*() {
yield* [[2, 3], [3, 3], [2, 3], [3, 2], [2, 10], [3, 3], [2, 3], [3, 3], [2, 1], [1, 1], [2, 3], [1, 1], [3, 1], [1, 1], [3, 4], [2, 9], [3, 3], [2, 3], [3, 2], [2, 4], [3, 1]];
yield* [0, 3, 2].map(i => [i, 36]);
while (true) {
for(let i = 0; i < 4; i++)
{
yield* [[2, 25], [3, 8]];
}
for(let i = 0; i < 4; i++)
{
yield* [[0, 25], [1, 8]];
}
yield* [[1, 50]];
}
})();
this.nextCall = 0;
}
if (turn === this.nextCall) {
const [dir, delay] = this.generator.next().value;
[api.awayX, api.awayY, api.towardsX, api.towardsY][dir].bind(api)();
this.nextCall += delay;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment