3 ms·
>I start most of my algorithms with while (true) That's gonna hurt >When you’ve got a while (true)* loop that searches a tree, it’s gonna throw you an infinit
by ramesh31 4y ago
>I start most of my algorithms with while (true)
That's gonna hurt
>When you’ve got a while (true)* loop that searches a tree, it’s gonna throw you an infinite loop every now and then. Fortunately, the more times this happens the better you’ll get at lightweight debugging strategies, and the more familiar you’ll become with the algorithm and the data structures
I like your style, kid.
- quickthrower2 4y agoI always add a counter to the infinite loops to break out of them incase of unexpectedly high number of iterations
- bee_rider 4y agoError out or something? Otherwise it would seem the program is in a weird state.
- quickthrower2 4y agoError, or do the sensible “no results found” for example in the tree search.
- eps 4y ago... and then what?
- scotty79 4y agoLike the article said. Break out into a debugger and figure out why it got stuck.
- Jach 4y agoReminds me of another style: "Just do it, hack! I approach code like games, rush deep into room, trigger all NPCs, die, after respawn I know where NPCs are." --@bkaradzic