|
1 | 1 | #include "conditions/all_in_chess.h" |
2 | 2 | #include "position/position.h" |
3 | | -#include "pieces/walks/pawns/en_passant.h" |
4 | 3 | #include "solving/has_solution_type.h" |
5 | 4 | #include "stipulation/stipulation.h" |
6 | 5 | #include "stipulation/pipe.h" |
@@ -417,77 +416,6 @@ void all_in_chess_move_generator_solve(slice_index si) |
417 | 416 | TraceFunctionResultEnd(); |
418 | 417 | } |
419 | 418 |
|
420 | | -static ply find_ply_with_potentially_repeated_position(void) |
421 | | -{ |
422 | | - ply result; |
423 | | - ply const parent = parent_ply[nbply]; |
424 | | - |
425 | | - TraceFunctionEntry(__func__); |
426 | | - TraceFunctionParamListEnd(); |
427 | | - |
428 | | - if (parent==ply_retro_move || trait[parent]==trait[nbply]) |
429 | | - result = ply_nil; |
430 | | - else |
431 | | - result = parent_ply[parent]; |
432 | | - |
433 | | - TraceFunctionExit(__func__); |
434 | | - TraceFunctionResult("%u",result); |
435 | | - TraceFunctionResultEnd(); |
436 | | - return result; |
437 | | -} |
438 | | - |
439 | | -static boolean en_passant_modified_since_last_move_of_same_side(void) |
440 | | -{ |
441 | | - boolean result = false; |
442 | | - |
443 | | - TraceFunctionEntry(__func__); |
444 | | - TraceFunctionParamListEnd(); |
445 | | - |
446 | | - { |
447 | | - ply const ply_position_potentially_repeated = find_ply_with_potentially_repeated_position(); |
448 | | - |
449 | | - if (ply_position_potentially_repeated!=ply_nil) |
450 | | - { |
451 | | - assert(trait[nbply]==trait[ply_position_potentially_repeated]); |
452 | | - |
453 | | - if (en_passant_was_multistep_played(ply_position_potentially_repeated)) |
454 | | - { |
455 | | - TraceSquare(en_passant_multistep_over[en_passant_top[ply_position_potentially_repeated]]);TraceEOL(); |
456 | | - |
457 | | - if (en_passant_was_multistep_played(nbply)) |
458 | | - { |
459 | | - /* en passant rights potentially modified */ |
460 | | - TraceSquare(en_passant_multistep_over[en_passant_top[nbply]]);TraceEOL(); |
461 | | - result = en_passant_multistep_over[en_passant_top[ply_position_potentially_repeated]]!=en_passant_multistep_over[en_passant_top[nbply]]; |
462 | | - } |
463 | | - else |
464 | | - { |
465 | | - /* en passant rights lost */ |
466 | | - result = true; |
467 | | - } |
468 | | - } |
469 | | - else |
470 | | - { |
471 | | - if (en_passant_was_multistep_played(nbply)) |
472 | | - { |
473 | | - /* en passant rights added */ |
474 | | - TraceSquare(en_passant_multistep_over[en_passant_top[nbply]]);TraceEOL(); |
475 | | - result = true; |
476 | | - } |
477 | | - else |
478 | | - { |
479 | | - /* no en passant activity */ |
480 | | - } |
481 | | - } |
482 | | - } |
483 | | - } |
484 | | - |
485 | | - TraceFunctionExit(__func__); |
486 | | - TraceFunctionResult("%u",result); |
487 | | - TraceFunctionResultEnd(); |
488 | | - return result; |
489 | | -} |
490 | | - |
491 | 419 | /* Try to solve in solve_nr_remaining half-moves. |
492 | 420 | * @param si slice index |
493 | 421 | * @note assigns solve_result the length of solution found and written, i.e.: |
@@ -527,13 +455,8 @@ void all_in_chess_undo_move_avoider_solve(slice_index si) |
527 | 455 | if (move_effect_journal[parent_movement].u.piece_movement.from==move_effect_journal[movement].u.piece_movement.to |
528 | 456 | && move_effect_journal[parent_movement].u.piece_movement.to==move_effect_journal[movement].u.piece_movement.from |
529 | 457 | && move_effect_journal[parent_movement].u.piece_movement.moving==move_effect_journal[movement].u.piece_movement.moving |
530 | | - && move_effect_journal[parent_movement].u.piece_movement.movingspec==move_effect_journal[movement].u.piece_movement.movingspec |
531 | | - && !en_passant_modified_since_last_move_of_same_side()) |
532 | | - { |
533 | | - TraceValue("%u",nbply); |
534 | | - TraceText("AllInChess deems this move illegal because it undoes the preceding move\n"); |
| 458 | + && move_effect_journal[parent_movement].u.piece_movement.movingspec==move_effect_journal[movement].u.piece_movement.movingspec) |
535 | 459 | solve_result = this_move_is_illegal; |
536 | | - } |
537 | 460 | else |
538 | 461 | pipe_solve_delegate(si); |
539 | 462 | } |
|
0 commit comments