Last active
October 29, 2019 01:58
-
-
Save Brilliand/2d632fb11ea1a7b1b73788d396a6a45d to your computer and use it in GitHub Desktop.
"Backstabber" bot for Grid Game KotH
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const turn = api.turn(); | |
if (turn === 0) { | |
this.generator = (function*() { | |
yield* [[0, 24], [1], [0], [3], [0, 3]]; | |
for(let i = 0; i < 40; i++) { | |
yield* [[1], [2, 2]]; | |
} | |
while (true) { | |
for(let i = 0; i < 40; i++) { | |
yield* [[3, 2], [2]]; | |
} | |
for(let i = 0; i < 40; i++) { | |
yield* [[0, 2], [1]]; | |
} | |
for(let i = 0; i < 40; i++) { | |
yield* [[3], [0, 2]]; | |
} | |
for(let i = 0; i < 40; i++) { | |
yield* [[0, 2], [3]]; | |
} | |
for(let i = 0; i < 40; i++) { | |
yield* [[1], [0, 2]]; | |
} | |
} | |
})(); | |
this.nextCall = 0; | |
} | |
if (turn === this.nextCall) { | |
const [dir, delay = 1] = 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