/* Try to solve in solve_nr_remaining half-moves. * @param si slice index * @note assigns solve_result the length of solution found and written, i.e.: * previous_move_is_illegal the move just played is illegal * this_move_is_illegal the move being played is illegal * immobility_on_next_move the moves just played led to an * unintended immobility on the next move * <=n+1 length of shortest solution found (n+1 only if in next * branch) * n+2 no solution found in this branch * n+3 no solution found in next branch * (with n denominating solve_nr_remaining) */ void exclusive_chess_legality_tester_solve(slice_index si) { TraceFunctionEntry(__func__); TraceFunctionParam("%u",si); TraceFunctionParamListEnd(); if ((table_length(exclusive_chess_undecidable_continuations[parent_ply[nbply]]) +exclusive_chess_nr_continuations_reaching_goal[parent_ply[nbply]]) >1) { if (is_current_move_in_table(exclusive_chess_undecidable_continuations[parent_ply[nbply]])) solve_result = this_move_is_illegal; else switch (conditional_pipe_solve_delegate(temporary_hack_mate_tester[advers(trait[nbply])])) { case this_move_is_illegal: solve_result = this_move_is_illegal; break; case previous_move_has_not_solved: pipe_solve_delegate(si); break; default: solve_result = previous_move_has_solved; break; } } else pipe_solve_delegate(si); TraceFunctionExit(__func__); TraceFunctionResultEnd(); }
/* Try to solve in solve_nr_remaining half-moves. * @param si slice index * @note assigns solve_result the length of solution found and written, i.e.: * previous_move_is_illegal the move just played is illegal * this_move_is_illegal the move being played is illegal * immobility_on_next_move the moves just played led to an * unintended immobility on the next move * <=n+1 length of shortest solution found (n+1 only if in next * branch) * n+2 no solution found in this branch * n+3 no solution found in next branch * (with n denominating solve_nr_remaining) */ void exclusive_chess_undecidable_writer_tree_solve(slice_index si) { TraceFunctionEntry(__func__); TraceFunctionParam("%u",si); TraceFunctionParamListEnd(); if (is_current_move_in_table(exclusive_chess_undecidable_continuations[parent_ply[nbply]])) SignalExclusiveRefutedUndecidable(); else { pipe_solve_delegate(si); if (solve_result==previous_move_has_solved && exclusive_chess_nr_continuations_reaching_goal[parent_ply[nbply]]<2 && table_length(exclusive_chess_undecidable_continuations[parent_ply[nbply]])+exclusive_chess_nr_continuations_reaching_goal[parent_ply[nbply]]>1) SignalChecklessUndecidable(); } TraceFunctionExit(__func__); TraceFunctionResultEnd(); }
/* Try to solve in solve_nr_remaining half-moves. * @param si slice index * @note assigns solve_result the length of solution found and written, i.e.: * previous_move_is_illegal the move just played is illegal * this_move_is_illegal the move being played is illegal * immobility_on_next_move the moves just played led to an * unintended immobility on the next move * <=n+1 length of shortest solution found (n+1 only if in next * branch) * n+2 no solution found in this branch * n+3 no solution found in next branch * (with n denominating solve_nr_remaining) */ void threat_defeated_tester_solve(slice_index si) { ply const threats_ply = parent_ply[parent_ply[nbply]]; TraceFunctionEntry(__func__); TraceFunctionParam("%u",si); TraceFunctionParamListEnd(); pipe_solve_delegate(si); /* we are not interested in whether threats are refuted when we are looking * for short continuations to defenses */ if (solve_nr_remaining>=threat_lengths[threats_ply]-2) { if (is_current_move_in_table(threats[threats_ply])) { if (move_has_solved()) { --nr_threats_to_be_confirmed; if (nr_threats_to_be_confirmed>0) /* threats tried so far still work (perhaps shorter than * before the current defense), but we haven't tried all * threats yet -> don't stop the iteration over the * attacking moves */ solve_result = MOVE_HAS_NOT_SOLVED_LENGTH(); } else if (solve_nr_remaining==threat_lengths[threats_ply]-1) /* we have found a defeated threat -> stop the iteration */ solve_result = MOVE_HAS_SOLVED_LENGTH(); } else /* not a threat -> don't stop the iteration */ solve_result = MOVE_HAS_NOT_SOLVED_LENGTH(); } TraceFunctionExit(__func__); TraceFunctionResultEnd(); }