C
C#2y ago
luness

❔ Getting multiple output of my count in this code:https://pastebin.com/c7RsL47e

When i try to solve my puzzle with size 2 and i manage to solve it in 3 steps it prints out like this in console : "It took 3 steps to solve the puzzle It took 0 steps to solve the puzzle It took 0 steps to solve the puzzle" why?
5 Replies
Doombox
Doombox2y ago
because you're calling StartGame recursively but not actually returning where necessary
else
{
StartGame();
return;
}
else
{
StartGame();
return;
}
will prevent it going any further in the method
luness
lunessOP2y ago
o.o thank you very much man, appreciate it!
Doombox
Doombox2y ago
one of the dangers of recursion is that it's dangerous goodthinking
luness
lunessOP2y ago
hahaha trueee, gotta be careful what you're coding 🙂 RTXHmm
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server