228 lines
3.8 KiB
JSON
228 lines
3.8 KiB
JSON
{
|
|
"function": "freeCells",
|
|
"cases": [
|
|
{
|
|
"name": "free-cells-row-major-order",
|
|
"args": [
|
|
{
|
|
"width": 3,
|
|
"height": 2,
|
|
"snake": [
|
|
{
|
|
"x": 0,
|
|
"y": 0
|
|
}
|
|
],
|
|
"dir": "Right",
|
|
"nextDir": "Right",
|
|
"apple": null,
|
|
"seed": 0,
|
|
"score": 0,
|
|
"status": "Playing",
|
|
"frame": 0
|
|
}
|
|
],
|
|
"expected": [
|
|
{
|
|
"x": 1,
|
|
"y": 0
|
|
},
|
|
{
|
|
"x": 2,
|
|
"y": 0
|
|
},
|
|
{
|
|
"x": 0,
|
|
"y": 1
|
|
},
|
|
{
|
|
"x": 1,
|
|
"y": 1
|
|
},
|
|
{
|
|
"x": 2,
|
|
"y": 1
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "free-cells-skip-snake",
|
|
"args": [
|
|
{
|
|
"width": 3,
|
|
"height": 2,
|
|
"snake": [
|
|
{
|
|
"x": 1,
|
|
"y": 0
|
|
},
|
|
{
|
|
"x": 0,
|
|
"y": 0
|
|
}
|
|
],
|
|
"dir": "Right",
|
|
"nextDir": "Right",
|
|
"apple": null,
|
|
"seed": 0,
|
|
"score": 0,
|
|
"status": "Playing",
|
|
"frame": 0
|
|
}
|
|
],
|
|
"expected": [
|
|
{
|
|
"x": 2,
|
|
"y": 0
|
|
},
|
|
{
|
|
"x": 0,
|
|
"y": 1
|
|
},
|
|
{
|
|
"x": 1,
|
|
"y": 1
|
|
},
|
|
{
|
|
"x": 2,
|
|
"y": 1
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "free-cells-snake-in-second-row",
|
|
"args": [
|
|
{
|
|
"width": 3,
|
|
"height": 2,
|
|
"snake": [
|
|
{
|
|
"x": 2,
|
|
"y": 1
|
|
},
|
|
{
|
|
"x": 1,
|
|
"y": 1
|
|
},
|
|
{
|
|
"x": 1,
|
|
"y": 0
|
|
}
|
|
],
|
|
"dir": "Right",
|
|
"nextDir": "Right",
|
|
"apple": null,
|
|
"seed": 0,
|
|
"score": 0,
|
|
"status": "Playing",
|
|
"frame": 0
|
|
}
|
|
],
|
|
"expected": [
|
|
{
|
|
"x": 0,
|
|
"y": 0
|
|
},
|
|
{
|
|
"x": 2,
|
|
"y": 0
|
|
},
|
|
{
|
|
"x": 0,
|
|
"y": 1
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "free-cells-apple-cell-is-still-free",
|
|
"args": [
|
|
{
|
|
"width": 3,
|
|
"height": 2,
|
|
"snake": [
|
|
{
|
|
"x": 1,
|
|
"y": 0
|
|
},
|
|
{
|
|
"x": 0,
|
|
"y": 0
|
|
}
|
|
],
|
|
"dir": "Right",
|
|
"nextDir": "Right",
|
|
"apple": {
|
|
"x": 2,
|
|
"y": 0
|
|
},
|
|
"seed": 0,
|
|
"score": 0,
|
|
"status": "Playing",
|
|
"frame": 0
|
|
}
|
|
],
|
|
"expected": [
|
|
{
|
|
"x": 2,
|
|
"y": 0
|
|
},
|
|
{
|
|
"x": 0,
|
|
"y": 1
|
|
},
|
|
{
|
|
"x": 1,
|
|
"y": 1
|
|
},
|
|
{
|
|
"x": 2,
|
|
"y": 1
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "free-cells-full-board-is-empty",
|
|
"args": [
|
|
{
|
|
"width": 3,
|
|
"height": 2,
|
|
"snake": [
|
|
{
|
|
"x": 0,
|
|
"y": 0
|
|
},
|
|
{
|
|
"x": 1,
|
|
"y": 0
|
|
},
|
|
{
|
|
"x": 2,
|
|
"y": 0
|
|
},
|
|
{
|
|
"x": 2,
|
|
"y": 1
|
|
},
|
|
{
|
|
"x": 1,
|
|
"y": 1
|
|
},
|
|
{
|
|
"x": 0,
|
|
"y": 1
|
|
}
|
|
],
|
|
"dir": "Right",
|
|
"nextDir": "Right",
|
|
"apple": null,
|
|
"seed": 0,
|
|
"score": 0,
|
|
"status": "Playing",
|
|
"frame": 0
|
|
}
|
|
],
|
|
"expected": []
|
|
}
|
|
]
|
|
}
|