X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=matchsticks-search.git;a=blobdiff_plain;f=main.c;h=11bdf0fba64e7605e11e54511142be5d20bbf689;hp=de880e9c356936fa2e847cce8d166ffa9941f6eb;hb=5d8f0782034b510b146a1b93d8f0c8f303eeb811;hpb=410a6030c8746d4369842cb0e0e35606c7ea4130 diff --git a/main.c b/main.c index de880e9..11bdf0f 100644 --- a/main.c +++ b/main.c @@ -119,8 +119,18 @@ static void progress_eol(void) { static void set_best(double new_best) { best = new_best; - n_max_frags = floor(n / best); - m_max_frags = floor(m / best); + /* + * When computing n_max_frags, we want to set a value that will skip + * anything that won't provide strictly better solutions. So we + * want + * frags < n / best + * _ _ + * <=> frags < | n / best | + * _ _ + * <=> frags <= | n / best | - 1 + */ + n_max_frags = ceil(n / best) - 1; + m_max_frags = ceil(m / best) - 1; } /*----- multicore support -----*/