feat(js): m04 random and spawn with fixtures and tests
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
2e39f23bb3
commit
08b462d5cc
@@ -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": []
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
{
|
||||
"function": "intBelow",
|
||||
"cases": [
|
||||
{
|
||||
"name": "below-6-from-seed-0",
|
||||
"args": [
|
||||
6,
|
||||
0
|
||||
],
|
||||
"expected": [
|
||||
2,
|
||||
1831565813
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "below-1-from-seed-0",
|
||||
"args": [
|
||||
1,
|
||||
0
|
||||
],
|
||||
"expected": [
|
||||
0,
|
||||
1831565813
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "below-2-from-seed-1",
|
||||
"args": [
|
||||
2,
|
||||
1
|
||||
],
|
||||
"expected": [
|
||||
1,
|
||||
1831565814
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "below-10-from-seed-1",
|
||||
"args": [
|
||||
10,
|
||||
1
|
||||
],
|
||||
"expected": [
|
||||
7,
|
||||
1831565814
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "below-3-from-seed-4294967295",
|
||||
"args": [
|
||||
3,
|
||||
4294967295
|
||||
],
|
||||
"expected": [
|
||||
2,
|
||||
1831565812
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "below-400-from-seed-42",
|
||||
"args": [
|
||||
400,
|
||||
42
|
||||
],
|
||||
"expected": [
|
||||
156,
|
||||
1831565855
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "below-4-from-seed-12345",
|
||||
"args": [
|
||||
4,
|
||||
12345
|
||||
],
|
||||
"expected": [
|
||||
1,
|
||||
1831578158
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
{
|
||||
"function": "newGame",
|
||||
"cases": [
|
||||
{
|
||||
"name": "seed-0",
|
||||
"args": [
|
||||
0
|
||||
],
|
||||
"expected": {
|
||||
"width": 20,
|
||||
"height": 20,
|
||||
"snake": [
|
||||
{
|
||||
"x": 10,
|
||||
"y": 10
|
||||
},
|
||||
{
|
||||
"x": 9,
|
||||
"y": 10
|
||||
},
|
||||
{
|
||||
"x": 8,
|
||||
"y": 10
|
||||
}
|
||||
],
|
||||
"dir": "Right",
|
||||
"nextDir": "Right",
|
||||
"apple": {
|
||||
"x": 18,
|
||||
"y": 13
|
||||
},
|
||||
"seed": 1831565813,
|
||||
"score": 0,
|
||||
"status": "Playing",
|
||||
"frame": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "seed-42",
|
||||
"args": [
|
||||
42
|
||||
],
|
||||
"expected": {
|
||||
"width": 20,
|
||||
"height": 20,
|
||||
"snake": [
|
||||
{
|
||||
"x": 10,
|
||||
"y": 10
|
||||
},
|
||||
{
|
||||
"x": 9,
|
||||
"y": 10
|
||||
},
|
||||
{
|
||||
"x": 8,
|
||||
"y": 10
|
||||
}
|
||||
],
|
||||
"dir": "Right",
|
||||
"nextDir": "Right",
|
||||
"apple": {
|
||||
"x": 1,
|
||||
"y": 9
|
||||
},
|
||||
"seed": 1831565855,
|
||||
"score": 0,
|
||||
"status": "Playing",
|
||||
"frame": 0
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,305 @@
|
||||
{
|
||||
"function": "nextUint32",
|
||||
"cases": [
|
||||
{
|
||||
"name": "seed-0-step-1",
|
||||
"args": [
|
||||
0
|
||||
],
|
||||
"expected": [
|
||||
1144304738,
|
||||
1831565813
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "seed-0-step-2",
|
||||
"args": [
|
||||
1831565813
|
||||
],
|
||||
"expected": [
|
||||
1416247,
|
||||
3663131626
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "seed-0-step-3",
|
||||
"args": [
|
||||
3663131626
|
||||
],
|
||||
"expected": [
|
||||
958946056,
|
||||
1199730143
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "seed-0-step-4",
|
||||
"args": [
|
||||
1199730143
|
||||
],
|
||||
"expected": [
|
||||
627933444,
|
||||
3031295956
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "seed-0-step-5",
|
||||
"args": [
|
||||
3031295956
|
||||
],
|
||||
"expected": [
|
||||
2007157716,
|
||||
567894473
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "seed-0-step-6",
|
||||
"args": [
|
||||
567894473
|
||||
],
|
||||
"expected": [
|
||||
2340967985,
|
||||
2399460286
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "seed-0-step-7",
|
||||
"args": [
|
||||
2399460286
|
||||
],
|
||||
"expected": [
|
||||
2642484575,
|
||||
4231026099
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "seed-0-step-8",
|
||||
"args": [
|
||||
4231026099
|
||||
],
|
||||
"expected": [
|
||||
2787370982,
|
||||
1767624616
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "seed-0-step-9",
|
||||
"args": [
|
||||
1767624616
|
||||
],
|
||||
"expected": [
|
||||
1958536065,
|
||||
3599190429
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "seed-0-step-10",
|
||||
"args": [
|
||||
3599190429
|
||||
],
|
||||
"expected": [
|
||||
2496316458,
|
||||
1135788946
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "seed-1-step-1",
|
||||
"args": [
|
||||
1
|
||||
],
|
||||
"expected": [
|
||||
2693262067,
|
||||
1831565814
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "seed-1-step-2",
|
||||
"args": [
|
||||
1831565814
|
||||
],
|
||||
"expected": [
|
||||
11749833,
|
||||
3663131627
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "seed-1-step-3",
|
||||
"args": [
|
||||
3663131627
|
||||
],
|
||||
"expected": [
|
||||
2265367787,
|
||||
1199730144
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "seed-1-step-4",
|
||||
"args": [
|
||||
1199730144
|
||||
],
|
||||
"expected": [
|
||||
4213581821,
|
||||
3031295957
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "seed-1-step-5",
|
||||
"args": [
|
||||
3031295957
|
||||
],
|
||||
"expected": [
|
||||
4159151403,
|
||||
567894474
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "seed-1-step-6",
|
||||
"args": [
|
||||
567894474
|
||||
],
|
||||
"expected": [
|
||||
1207330352,
|
||||
2399460287
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "seed-1-step-7",
|
||||
"args": [
|
||||
2399460287
|
||||
],
|
||||
"expected": [
|
||||
2632122864,
|
||||
4231026100
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "seed-1-step-8",
|
||||
"args": [
|
||||
4231026100
|
||||
],
|
||||
"expected": [
|
||||
3095568220,
|
||||
1767624617
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "seed-1-step-9",
|
||||
"args": [
|
||||
1767624617
|
||||
],
|
||||
"expected": [
|
||||
1828783984,
|
||||
3599190430
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "seed-1-step-10",
|
||||
"args": [
|
||||
3599190430
|
||||
],
|
||||
"expected": [
|
||||
4272732017,
|
||||
1135788947
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "seed-4294967295-step-1",
|
||||
"args": [
|
||||
4294967295
|
||||
],
|
||||
"expected": [
|
||||
3850105811,
|
||||
1831565812
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "seed-4294967295-step-2",
|
||||
"args": [
|
||||
1831565812
|
||||
],
|
||||
"expected": [
|
||||
813802916,
|
||||
3663131625
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "seed-4294967295-step-3",
|
||||
"args": [
|
||||
3663131625
|
||||
],
|
||||
"expected": [
|
||||
3073704848,
|
||||
1199730142
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "seed-4294967295-step-4",
|
||||
"args": [
|
||||
1199730142
|
||||
],
|
||||
"expected": [
|
||||
4054706436,
|
||||
3031295955
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "seed-4294967295-step-5",
|
||||
"args": [
|
||||
3031295955
|
||||
],
|
||||
"expected": [
|
||||
3630262831,
|
||||
567894472
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "seed-4294967295-step-6",
|
||||
"args": [
|
||||
567894472
|
||||
],
|
||||
"expected": [
|
||||
2315588663,
|
||||
2399460285
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "seed-4294967295-step-7",
|
||||
"args": [
|
||||
2399460285
|
||||
],
|
||||
"expected": [
|
||||
2922715533,
|
||||
4231026098
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "seed-4294967295-step-8",
|
||||
"args": [
|
||||
4231026098
|
||||
],
|
||||
"expected": [
|
||||
2042566601,
|
||||
1767624615
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "seed-4294967295-step-9",
|
||||
"args": [
|
||||
1767624615
|
||||
],
|
||||
"expected": [
|
||||
583504547,
|
||||
3599190428
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "seed-4294967295-step-10",
|
||||
"args": [
|
||||
3599190428
|
||||
],
|
||||
"expected": [
|
||||
4245337221,
|
||||
1135788945
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,452 @@
|
||||
{
|
||||
"function": "spawnApple",
|
||||
"cases": [
|
||||
{
|
||||
"name": "spawn-picks-a-free-cell-and-advances-seed",
|
||||
"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": {
|
||||
"width": 3,
|
||||
"height": 2,
|
||||
"snake": [
|
||||
{
|
||||
"x": 1,
|
||||
"y": 0
|
||||
},
|
||||
{
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
],
|
||||
"dir": "Right",
|
||||
"nextDir": "Right",
|
||||
"apple": {
|
||||
"x": 1,
|
||||
"y": 1
|
||||
},
|
||||
"seed": 1831565813,
|
||||
"score": 0,
|
||||
"status": "Playing",
|
||||
"frame": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "spawn-other-seed-picks-other-cell",
|
||||
"args": [
|
||||
{
|
||||
"width": 3,
|
||||
"height": 2,
|
||||
"snake": [
|
||||
{
|
||||
"x": 1,
|
||||
"y": 0
|
||||
},
|
||||
{
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
],
|
||||
"dir": "Right",
|
||||
"nextDir": "Right",
|
||||
"apple": null,
|
||||
"seed": 1,
|
||||
"score": 0,
|
||||
"status": "Playing",
|
||||
"frame": 0
|
||||
}
|
||||
],
|
||||
"expected": {
|
||||
"width": 3,
|
||||
"height": 2,
|
||||
"snake": [
|
||||
{
|
||||
"x": 1,
|
||||
"y": 0
|
||||
},
|
||||
{
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
],
|
||||
"dir": "Right",
|
||||
"nextDir": "Right",
|
||||
"apple": {
|
||||
"x": 2,
|
||||
"y": 1
|
||||
},
|
||||
"seed": 1831565814,
|
||||
"score": 0,
|
||||
"status": "Playing",
|
||||
"frame": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "spawn-with-one-free-cell",
|
||||
"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
|
||||
}
|
||||
],
|
||||
"dir": "Right",
|
||||
"nextDir": "Right",
|
||||
"apple": null,
|
||||
"seed": 7,
|
||||
"score": 0,
|
||||
"status": "Playing",
|
||||
"frame": 0
|
||||
}
|
||||
],
|
||||
"expected": {
|
||||
"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
|
||||
}
|
||||
],
|
||||
"dir": "Right",
|
||||
"nextDir": "Right",
|
||||
"apple": {
|
||||
"x": 0,
|
||||
"y": 1
|
||||
},
|
||||
"seed": 1831565820,
|
||||
"score": 0,
|
||||
"status": "Playing",
|
||||
"frame": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "spawn-on-full-board",
|
||||
"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": 5,
|
||||
"score": 0,
|
||||
"status": "Playing",
|
||||
"frame": 0
|
||||
}
|
||||
],
|
||||
"expected": {
|
||||
"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": 5,
|
||||
"score": 0,
|
||||
"status": "Won",
|
||||
"frame": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "spawn-apple-present-unchanged",
|
||||
"args": [
|
||||
{
|
||||
"width": 3,
|
||||
"height": 2,
|
||||
"snake": [
|
||||
{
|
||||
"x": 1,
|
||||
"y": 0
|
||||
},
|
||||
{
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
],
|
||||
"dir": "Right",
|
||||
"nextDir": "Right",
|
||||
"apple": {
|
||||
"x": 2,
|
||||
"y": 1
|
||||
},
|
||||
"seed": 5,
|
||||
"score": 0,
|
||||
"status": "Playing",
|
||||
"frame": 0
|
||||
}
|
||||
],
|
||||
"expected": {
|
||||
"width": 3,
|
||||
"height": 2,
|
||||
"snake": [
|
||||
{
|
||||
"x": 1,
|
||||
"y": 0
|
||||
},
|
||||
{
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
],
|
||||
"dir": "Right",
|
||||
"nextDir": "Right",
|
||||
"apple": {
|
||||
"x": 2,
|
||||
"y": 1
|
||||
},
|
||||
"seed": 5,
|
||||
"score": 0,
|
||||
"status": "Playing",
|
||||
"frame": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "spawn-paused-unchanged",
|
||||
"args": [
|
||||
{
|
||||
"width": 3,
|
||||
"height": 2,
|
||||
"snake": [
|
||||
{
|
||||
"x": 1,
|
||||
"y": 0
|
||||
},
|
||||
{
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
],
|
||||
"dir": "Right",
|
||||
"nextDir": "Right",
|
||||
"apple": null,
|
||||
"seed": 5,
|
||||
"score": 0,
|
||||
"status": "Paused",
|
||||
"frame": 0
|
||||
}
|
||||
],
|
||||
"expected": {
|
||||
"width": 3,
|
||||
"height": 2,
|
||||
"snake": [
|
||||
{
|
||||
"x": 1,
|
||||
"y": 0
|
||||
},
|
||||
{
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
],
|
||||
"dir": "Right",
|
||||
"nextDir": "Right",
|
||||
"apple": null,
|
||||
"seed": 5,
|
||||
"score": 0,
|
||||
"status": "Paused",
|
||||
"frame": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "spawn-gameover-unchanged",
|
||||
"args": [
|
||||
{
|
||||
"width": 3,
|
||||
"height": 2,
|
||||
"snake": [
|
||||
{
|
||||
"x": 1,
|
||||
"y": 0
|
||||
},
|
||||
{
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
],
|
||||
"dir": "Right",
|
||||
"nextDir": "Right",
|
||||
"apple": null,
|
||||
"seed": 5,
|
||||
"score": 0,
|
||||
"status": "GameOver",
|
||||
"frame": 0
|
||||
}
|
||||
],
|
||||
"expected": {
|
||||
"width": 3,
|
||||
"height": 2,
|
||||
"snake": [
|
||||
{
|
||||
"x": 1,
|
||||
"y": 0
|
||||
},
|
||||
{
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
],
|
||||
"dir": "Right",
|
||||
"nextDir": "Right",
|
||||
"apple": null,
|
||||
"seed": 5,
|
||||
"score": 0,
|
||||
"status": "GameOver",
|
||||
"frame": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "spawn-won-unchanged",
|
||||
"args": [
|
||||
{
|
||||
"width": 3,
|
||||
"height": 2,
|
||||
"snake": [
|
||||
{
|
||||
"x": 1,
|
||||
"y": 0
|
||||
},
|
||||
{
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
],
|
||||
"dir": "Right",
|
||||
"nextDir": "Right",
|
||||
"apple": null,
|
||||
"seed": 5,
|
||||
"score": 0,
|
||||
"status": "Won",
|
||||
"frame": 0
|
||||
}
|
||||
],
|
||||
"expected": {
|
||||
"width": 3,
|
||||
"height": 2,
|
||||
"snake": [
|
||||
{
|
||||
"x": 1,
|
||||
"y": 0
|
||||
},
|
||||
{
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
],
|
||||
"dir": "Right",
|
||||
"nextDir": "Right",
|
||||
"apple": null,
|
||||
"seed": 5,
|
||||
"score": 0,
|
||||
"status": "Won",
|
||||
"frame": 0
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user