mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 08:01:30 -07:00
Guess: Make 'H' key work properly with "Allow duplicates" off
Before it would not only generate an invalid guess, but also override the usual rules to allow you to submit it. Now guesses are only provided if they're valid, and I've adjusted the maximum-colour finder so that the code can actually find the correct guess. This should have no effect on the behaviour with "Allow duplicates" turned on.
This commit is contained in:
5
guess.c
5
guess.c
@ -707,7 +707,11 @@ static void compute_hint(const game_state *state, game_ui *ui)
|
|||||||
for (j = 0; j < state->params.npegs; ++j)
|
for (j = 0; j < state->params.npegs; ++j)
|
||||||
if (state->guesses[i]->pegs[j] > maxcolour)
|
if (state->guesses[i]->pegs[j] > maxcolour)
|
||||||
maxcolour = state->guesses[i]->pegs[j];
|
maxcolour = state->guesses[i]->pegs[j];
|
||||||
|
if (state->params.allow_multiple)
|
||||||
maxcolour = min(maxcolour + 1, state->params.ncolours);
|
maxcolour = min(maxcolour + 1, state->params.ncolours);
|
||||||
|
else
|
||||||
|
maxcolour = min(maxcolour + state->params.npegs,
|
||||||
|
state->params.ncolours);
|
||||||
|
|
||||||
increase_mincolour:
|
increase_mincolour:
|
||||||
for (i = 0; i < state->next_go; ++i) {
|
for (i = 0; i < state->next_go; ++i) {
|
||||||
@ -729,6 +733,7 @@ increase_mincolour:
|
|||||||
}
|
}
|
||||||
|
|
||||||
while (ui->hint->pegs[0] <= state->params.ncolours) {
|
while (ui->hint->pegs[0] <= state->params.ncolours) {
|
||||||
|
if (!is_markable(&state->params, ui->hint)) goto increment_pegrow;
|
||||||
for (i = 0; i < state->next_go; ++i) {
|
for (i = 0; i < state->next_go; ++i) {
|
||||||
mark_pegs(ui->hint, state->guesses[i], maxcolour);
|
mark_pegs(ui->hint, state->guesses[i], maxcolour);
|
||||||
for (j = 0; j < state->params.npegs; ++j)
|
for (j = 0; j < state->params.npegs; ++j)
|
||||||
|
Reference in New Issue
Block a user