PREV INDEX NEXT

Author: Stan Eisenstat
Subject: Re: [Cs223] <= on algorithm
Date: Tuesday, 14 Apr 2020, 19:20:10


    > Message Posted By: Unknown
    >
    > On the algorithm that is in the pset specificiation, why does it say
    > continue going through the loop while (n < MAXSTEPS), shouldnt it be n <=?
    > Or are we supposed to stop before we reach the maximum steps.

The loop stops when it finds a move from the current
position to the goal position.  If the current position
is N moves from the initial position, the number of
moves from initial to goal would be N+1.  Since we must
have N+1 <= MAXSTEPS, we must require N < MAXSTEPS.

--Stan-
PREV INDEX NEXT