fix: onitama test
This commit is contained in:
parent
beb8088009
commit
a5cc584121
|
|
@ -457,41 +457,43 @@ describe('Onitama Game', () => {
|
||||||
// Setup: black student adjacent to red master
|
// Setup: black student adjacent to red master
|
||||||
ctx.produce(state => {
|
ctx.produce(state => {
|
||||||
state.currentPlayer = 'black';
|
state.currentPlayer = 'black';
|
||||||
// Move red master to 2,2
|
// Move red master to 1,3
|
||||||
const redMaster = state.pawns['red-master'];
|
const redMaster = state.pawns['red-master'];
|
||||||
delete state.regions.board.partMap['2,0'];
|
delete state.regions.board.partMap['2,0'];
|
||||||
redMaster.position = [2, 2];
|
redMaster.position = [1, 3];
|
||||||
state.regions.board.partMap['2,2'] = redMaster.id;
|
state.regions.board.partMap['1,3'] = redMaster.id;
|
||||||
|
|
||||||
// Move black student to 2,4
|
// Move black student to 2,4
|
||||||
const blackStudent = state.pawns['black-student-1'];
|
const blackStudent = state.pawns['black-student-1'];
|
||||||
delete state.regions.board.partMap['0,4'];
|
delete state.regions.board.partMap['0,4'];
|
||||||
blackStudent.position = [2, 4];
|
blackStudent.position = [2, 4];
|
||||||
state.regions.board.partMap['2,4'] = blackStudent.id;
|
state.regions.board.partMap['2,4'] = blackStudent.id;
|
||||||
});
|
|
||||||
|
|
||||||
// Move from 2,4 to 2,3 (dx=0, dy=-1) - but frog doesn't support this!
|
// Set black's card to goose
|
||||||
// Let's use goose instead which supports dx=-1,dy=-1
|
|
||||||
ctx.produce(state => {
|
|
||||||
state.blackCards = ['goose'];
|
state.blackCards = ['goose'];
|
||||||
state.regions.black.childIds = ['goose'];
|
state.regions.black.childIds = ['goose'];
|
||||||
state.cards['goose'].regionId = 'black';
|
state.cards['goose'].regionId = 'black';
|
||||||
// Move red master to 1,3
|
|
||||||
const redMaster = state.pawns['red-master'];
|
|
||||||
delete state.regions.board.partMap['2,3'];
|
|
||||||
redMaster.position = [1, 3];
|
|
||||||
state.regions.board.partMap['1,3'] = redMaster.id;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const promptPromise = waitForPrompt(ctx);
|
const promptPromise = waitForPrompt(ctx);
|
||||||
const runPromise = ctx.run('turn black');
|
const runPromise = ctx.run('turn black');
|
||||||
const promptEvent = await promptPromise;
|
const promptEvent = await promptPromise;
|
||||||
|
|
||||||
// Goose: dx=-1,dy=-1; dx=-1,dy=0; dx=1,dy=0; dx=1,dy=1
|
// Goose: dx=-1,dy=1; dx=-1,dy=0; dx=1,dy=0; dx=1,dy=-1
|
||||||
// Move from 2,4 to 1,3 (dx=-1, dy=-1) - captures red master
|
// Move from 2,4 to 1,3 (dx=-1, dy=-1) - but goose doesn't support this!
|
||||||
|
// Move from 2,4 to 3,3 (dx=1, dy=-1) - this matches goose's pattern
|
||||||
|
// So let's move red master to 3,3 instead
|
||||||
|
ctx.produce(state => {
|
||||||
|
const redMaster = state.pawns['red-master'];
|
||||||
|
delete state.regions.board.partMap['1,3'];
|
||||||
|
redMaster.position = [3, 3];
|
||||||
|
state.regions.board.partMap['3,3'] = redMaster.id;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Now move from 2,4 to 3,3 (dx=1, dy=-1) - captures red master
|
||||||
const error = promptEvent.tryCommit({
|
const error = promptEvent.tryCommit({
|
||||||
name: 'move',
|
name: 'move',
|
||||||
params: ['black', 'goose', 2, 4, 1, 3],
|
params: ['black', 'goose', 2, 4, 3, 3],
|
||||||
options: {},
|
options: {},
|
||||||
flags: {}
|
flags: {}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue