Skip to content

Commit 4c1ca50

Browse files
committed
fix: more 32nd bit bugs
1 parent 8618b77 commit 4c1ca50

2 files changed

Lines changed: 31 additions & 1 deletion

File tree

src/english/engine.test.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,36 @@ describe('tricky move', () => {
214214
});
215215
});
216216

217+
describe('tricky move 2', () => {
218+
let engine: EnglishDraughtsEngine;
219+
220+
beforeEach(() => {
221+
engine = EngineFactory.setup({
222+
board: {
223+
light: S[12],
224+
dark: S[31],
225+
king: 0,
226+
},
227+
player: DraughtsPlayer.DARK,
228+
});
229+
});
230+
231+
test('correct moves', () => {
232+
assert.sameDeepMembers(engine.moves, [
233+
{
234+
origin: S[31],
235+
destination: S[30],
236+
captures: 0,
237+
},
238+
{
239+
origin: S[31],
240+
destination: S[24],
241+
captures: 0,
242+
},
243+
]);
244+
});
245+
});
246+
217247
describe('simple jump', () => {
218248
let engine: EnglishDraughtsEngine;
219249

src/english/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export function decomposeBits(value: number): number[] {
2727
const split: number[] = [];
2828
for (let bit = 1; value; bit <<= 1) {
2929
if (value & bit) {
30-
split.push(bit);
30+
split.push(bit >>> 0);
3131
value ^= bit;
3232
}
3333
}

0 commit comments

Comments
 (0)