Skip to content

Instantly share code, notes, and snippets.

@mm304321141
Last active August 26, 2020 17:33
Show Gist options
  • Save mm304321141/34ebe7f69fe40826caec1f2156bcf636 to your computer and use it in GitHub Desktop.
Save mm304321141/34ebe7f69fe40826caec1f2156bcf636 to your computer and use it in GitHub Desktop.
TetrisAI API
{
"create" : { // create instance
"instance" : "player0", // instance id
"rule" : "toj", // rule
"ai" : "ZZZ_TOJ", // ai
"search" : "tspin", // search
"config" : { // global cfg
"thread" : 1, // bg threads
"memory" : 1024, // MB
"width" : 10,
"height" : 40,
"hold" : true,
},
"ZZZ_TOJ" : { // ai cfg
"table" : [0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 4, 5],
"param" : [0, 0, 0, 0],
"combo" : 0,
"under_attack" : 0,
"b2b" : 0,
},
"tspin" : { // search cfg
"allow_rotate_move" : false,
"allow_180" : false,
"allow_d" : false,
"is_20g" : false,
"last_rotate" : false,
},
},
"update" : { // update context
"instance" : "player0",
"ZZZ_TOJ" : { // ai cfg
"combo" : 2,
"under_attack" : 5,
"b2b" : 1,
},
"tspin" : { // search cfg
"last_rotate" : true,
},
"field" : {
"line" : ["1110011111", "1111001111"],
},
"curr" : {
"type" : "L"
"x" : 21,
"y" : 3,
"spin" : 0,
},
"hold" : {
"type" : "J",
"lock" : false,
}
"next" : "OISJLJT";
}
"run" : {
"instance" : "player0", // instance id
"duration" : 40, // ms
"location" : 2, // location.size
"path" : true, // need path
},
"destroy" : "player0", // instance id
}
{
"instance" : "player0", // instance id
"error" : "", // success if empty
"location" : [
{
"type" : "L"
"x" : 5,
"y" : 4,
"spin" : 0,
"hold" : false,
},
{
"type" : "J"
"x" : 3,
"y" : 2,
"spin" : 1,
"hold" : true,
},
],
"path" : "zRV",
}
const char* UniversalTetrisAI(const char*);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment