feat(js): m04 random and spawn with fixtures and tests
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2e39f23bb3
commit
08b462d5cc
11 files changed
+1332
No files matched your search
@@ -0,0 +1,227 @@
|
||||
{
|
||||
"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": []
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in new issue
Block a user