Skip to content

Commit

Permalink
don't tuck over empty locations
Browse files Browse the repository at this point in the history
  • Loading branch information
vid8687 committed Apr 14, 2021
1 parent aac3eb6 commit 0021de3
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions ak-trace_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,15 +340,21 @@ void ak::trace_graph(
}


if (next != -1U) {
std::cout << " TUCKING[2] at " << next << " which has " << info[next].knits << " knits." << std::endl;

if (next != -1U && info[next].knits)
{
//tuck 'next', turn, knit 'up':
if (next != -1U) tuck(next);
dir = (dir == Forward ? Backward : Forward);
if (next != -1U) miss(next);
knit(up);
}
else {
// don't tuck on an empty location
next = -1U;
dir = (dir == Forward ? Backward : Forward);
knit(up);
}

//tuck 'next', turn, knit 'up':
if (next != -1U) tuck(next);
dir = (dir == Forward ? Backward : Forward);
if (next != -1U) miss(next);
knit(up);
return true;
};

Expand Down

0 comments on commit 0021de3

Please sign in to comment.