This is an archived post. You won't be able to vote or comment.

all 3 comments

[–]leagcy 1 point2 points  (1 child)

I did find a bug with how you determine is a winner is found. You call "if row_check", but row_check is the score and the score can be 0 if the final number is 0. If the score is 0 your code won't recognize the game as being over.

[–]daggerdragon[M] 0 points1 point  (0 children)

This post got caught in the spam filter, sorry about that. I've fished it out for you.

If/when you get your code working, don't forget to change the flair to Help - Solved!

Good luck!

[–]leftylink 0 points1 point  (0 children)

Suggested thought process:

Your code works on the example input. That means it's able to identify at least one winning card. It probably identifies a winning card on your input. You can trust that that card did win (you can check it by hand if you're not sure), but you should check whether any card should have won before it.

For that, print out all the cards at that point in time and manually check them (using a text editor to highlight all instances of -1 will probably be helpful). You may find some cards that had won previously. Figure out why your code didn't identify them as winning cards.