Skip to content

Instantly share code, notes, and snippets.

@Gompyn
Last active August 27, 2020 06:36
Show Gist options
  • Save Gompyn/3a1c12bf9f2b52d80bf01c9b0e241e9c to your computer and use it in GitHub Desktop.
Save Gompyn/3a1c12bf9f2b52d80bf01c9b0e241e9c to your computer and use it in GitHub Desktop.
What I think the API maybe should include
when creating:
{
"game": {
"rule": "techmino",
// the rule includes the kick list, attack table, when and how garbage rises,
// how the garbage generates, where and how new block spawns... well, maybe
// everything I think a rule should contain
// following options are the variant of techmino rule
// but just ignoring some of them may also be okey
// basically I just copied the options of custom game
"turn": false,
"field": [10, inf], // width, height
"speed": "20G", // only supports 0G and 20G
"lock delay": "5", // maybe we don't need this?
"hold": true,
"nexts": {
"number": 5,
"randomizer": "hist4",
"bag": ["S", "T", "T5", "I5", "S"]
},
"spin": ["S", "T", "T5"] // spins that generate an attack
},
"operations": [
{
"type": "move",
"direction": "left",
"distance": inf // indicates as far as possible
},
{
"type": "spin",
"degree": -90 // only 0, 90, -90, 180 are possible
},
{
"type": "hold"
},
...
],
"config": {
"threads": 1,
"parameters": []
// other configs for the bot
}
}
when running:
{
"me": {
"reset": { // optional, only used to reset the internal state of the bot
"field": [],
"current": "I",
"hold": "S"
},
// new garbage, [2, 3] means [how many lines, where the hole is]
// how new garbage is is specific to the game, and this form is specific to techmino
"garbage": [[2, 3], [1, 3]],
"nexts": ["I", ...],
"NewGarbage": 4
},
"opponent": { // used only when there is only one opponent
"field": [],
"current": "I",
"hold": "T",
"nexts": ["I", ...],
"NewGarbage": 4
}
"time": 100 // ms
} returning {
"path": [0, 0, 2, 1], // integers in the "operations"
"expected": [[x1, y1], [x2, y2], [x3, y3]...]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment