@@ -348,19 +348,19 @@ describe('MoveGenerator', () => {
348
348
} ) ;
349
349
350
350
// Check specific directional moves
351
- const upMoves = moves . filter ( ( move ) => move . to > 28 && ( move . to - 28 ) % 8 === 0 ) ;
352
- const downMoves = moves . filter ( ( move ) => move . to < 28 && ( 28 - move . to ) % 8 === 0 ) ;
351
+ const upMoves = moves . filter ( move => move . to > 28 && ( move . to - 28 ) % 8 === 0 ) ;
352
+ const downMoves = moves . filter ( move => move . to < 28 && ( 28 - move . to ) % 8 === 0 ) ;
353
353
const rightMoves = moves . filter (
354
- ( move ) => move . to > 28 && Math . floor ( move . to / 8 ) === Math . floor ( 28 / 8 )
354
+ move => move . to > 28 && Math . floor ( move . to / 8 ) === Math . floor ( 28 / 8 )
355
355
) ;
356
356
const leftMoves = moves . filter (
357
- ( move ) => move . to < 28 && Math . floor ( move . to / 8 ) === Math . floor ( 28 / 8 )
357
+ move => move . to < 28 && Math . floor ( move . to / 8 ) === Math . floor ( 28 / 8 )
358
358
) ;
359
359
360
- expect ( upMoves ) . toHaveLength ( 3 ) ; // e5, e6, e7, e8
361
- expect ( downMoves ) . toHaveLength ( 4 ) ; // e3, e2, e1
362
- expect ( rightMoves ) . toHaveLength ( 3 ) ; // f4, g4, h4
363
- expect ( leftMoves ) . toHaveLength ( 4 ) ; // d4, c4, b4, a4
360
+ expect ( upMoves ) . toHaveLength ( 4 ) ; // e5, e6, e7, e8 (36, 44, 52, 60)
361
+ expect ( downMoves ) . toHaveLength ( 3 ) ; // e3, e2, e1 (20, 12, 4)
362
+ expect ( rightMoves ) . toHaveLength ( 3 ) ; // f4, g4, h4 (29, 30, 31)
363
+ expect ( leftMoves ) . toHaveLength ( 4 ) ; // d4, c4, b4, a4 (27, 26, 25, 24)
364
364
} ) ;
365
365
366
366
test ( 'should generate moves for rook in corner position' , ( ) => {
@@ -416,13 +416,13 @@ describe('MoveGenerator', () => {
416
416
417
417
// Should not include e6 or beyond in upward direction
418
418
const upwardMoves = moves . filter (
419
- ( move ) => move . to > 28 && ( move . to - 28 ) % 8 === 0
419
+ move => move . to > 28 && ( move . to - 28 ) % 8 === 0
420
420
) ;
421
421
expect ( upwardMoves ) . toHaveLength ( 1 ) ; // Only e5 (index 36)
422
422
expect ( upwardMoves [ 0 ] . to ) . toBe ( 36 ) ;
423
423
424
424
// Should not capture friendly piece
425
- const captureAtE6 = moves . find ( ( move ) => move . to === 44 ) ;
425
+ const captureAtE6 = moves . find ( move => move . to === 44 ) ;
426
426
expect ( captureAtE6 ) . toBeUndefined ( ) ;
427
427
} ) ;
428
428
@@ -438,7 +438,7 @@ describe('MoveGenerator', () => {
438
438
const moves = moveGenerator . generateRookMoves ( whiteRook , 28 ) ;
439
439
440
440
// Should include capture move at e6
441
- const captureMove = moves . find ( ( move ) => move . to === 44 ) ;
441
+ const captureMove = moves . find ( move => move . to === 44 ) ;
442
442
expect ( captureMove ) . toBeDefined ( ) ;
443
443
expect ( captureMove ) . toEqual ( {
444
444
from : 28 ,
@@ -451,7 +451,7 @@ describe('MoveGenerator', () => {
451
451
452
452
// Should not include moves beyond e6 in upward direction
453
453
const beyondCapture = moves . filter (
454
- ( move ) => move . to > 44 && ( move . to - 28 ) % 8 === 0
454
+ move => move . to > 44 && ( move . to - 28 ) % 8 === 0
455
455
) ;
456
456
expect ( beyondCapture ) . toHaveLength ( 0 ) ;
457
457
} ) ;
@@ -478,23 +478,23 @@ describe('MoveGenerator', () => {
478
478
expect ( moves . length ) . toBeLessThan ( 14 ) ;
479
479
480
480
// Check specific blocked/capture scenarios
481
- const upMoves = moves . filter ( ( move ) => move . to > 28 && ( move . to - 28 ) % 8 === 0 ) ;
481
+ const upMoves = moves . filter ( move => move . to > 28 && ( move . to - 28 ) % 8 === 0 ) ;
482
482
expect ( upMoves ) . toHaveLength ( 0 ) ; // Blocked by friendly piece
483
483
484
- const downMoves = moves . filter ( ( move ) => move . to < 28 && ( 28 - move . to ) % 8 === 0 ) ;
485
- expect ( downMoves . some ( ( move ) => move . to === 20 && move . type === 'capture' ) ) . toBe (
484
+ const downMoves = moves . filter ( move => move . to < 28 && ( 28 - move . to ) % 8 === 0 ) ;
485
+ expect ( downMoves . some ( move => move . to === 20 && move . type === 'capture' ) ) . toBe (
486
486
true
487
487
) ;
488
488
489
489
const rightMoves = moves . filter (
490
- ( move ) => move . to > 28 && Math . floor ( move . to / 8 ) === Math . floor ( 28 / 8 )
490
+ move => move . to > 28 && Math . floor ( move . to / 8 ) === Math . floor ( 28 / 8 )
491
491
) ;
492
492
expect ( rightMoves ) . toHaveLength ( 0 ) ; // Blocked by friendly piece
493
493
494
494
const leftMoves = moves . filter (
495
- ( move ) => move . to < 28 && Math . floor ( move . to / 8 ) === Math . floor ( 28 / 8 )
495
+ move => move . to < 28 && Math . floor ( move . to / 8 ) === Math . floor ( 28 / 8 )
496
496
) ;
497
- expect ( leftMoves . some ( ( move ) => move . to === 27 && move . type === 'capture' ) ) . toBe (
497
+ expect ( leftMoves . some ( move => move . to === 27 && move . type === 'capture' ) ) . toBe (
498
498
true
499
499
) ;
500
500
} ) ;
@@ -634,4 +634,4 @@ describe('MoveGenerator', () => {
634
634
expect ( moves ) . toEqual ( [ ] ) ;
635
635
} ) ;
636
636
} ) ;
637
- } ) ;
637
+ } ) ;
0 commit comments