Skip to content

Commit

Permalink
fix: more 32nd bit bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
loks0n committed Apr 2, 2023
1 parent 8618b77 commit 4c1ca50
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
30 changes: 30 additions & 0 deletions src/english/engine.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,36 @@ describe('tricky move', () => {
});
});

describe('tricky move 2', () => {
let engine: EnglishDraughtsEngine;

beforeEach(() => {
engine = EngineFactory.setup({
board: {
light: S[12],
dark: S[31],
king: 0,
},
player: DraughtsPlayer.DARK,
});
});

test('correct moves', () => {
assert.sameDeepMembers(engine.moves, [
{
origin: S[31],
destination: S[30],
captures: 0,
},
{
origin: S[31],
destination: S[24],
captures: 0,
},
]);
});
});

describe('simple jump', () => {
let engine: EnglishDraughtsEngine;

Expand Down
2 changes: 1 addition & 1 deletion src/english/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function decomposeBits(value: number): number[] {
const split: number[] = [];
for (let bit = 1; value; bit <<= 1) {
if (value & bit) {
split.push(bit);
split.push(bit >>> 0);
value ^= bit;
}
}
Expand Down

0 comments on commit 4c1ca50

Please sign in to comment.