Dead-end algorithim not finished

Stuck in infinite loop.