Skip to content

Instantly share code, notes, and snippets.

@Brilliand
Created October 29, 2019 21:00
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 Brilliand/9c65942bf924d9bb09e99d22daf0d8d0 to your computer and use it in GitHub Desktop.
Save Brilliand/9c65942bf924d9bb09e99d22daf0d8d0 to your computer and use it in GitHub Desktop.
"CBC Forever" bot for Grid Game KotH
const turn = api.turn();
const opening =
"SSSEEESSSEEEEEEEEEESSEEE"+
"SSSEEESSSEEEEEEESSEEEEEE"+
"SSSEEESSSEEEESSEEEEEEEEE"+
"SSSEEESSSESSEEEEEEEEEEEE";
const pattern = "NWSSSSEEESSSWNEESSEEEEEEEEEEEE";
if(turn < opening.length) {
switch (opening[turn]) {
case 'W':
api.awayX();
break;
case 'N':
api.awayY();
break;
case 'E':
api.towardsX();
break;
case 'S':
api.towardsY();
break;
}
} else {
switch (pattern[(turn-opening.length)%pattern.length]) {
case 'W':
api.awayX();
break;
case 'N':
api.awayY();
break;
case 'E':
api.towardsX();
break;
case 'S':
api.towardsY();
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment