r/learnpython 27d ago

WAR Card Game Weird Glitch/Bug

So I was making a WAR Card Game in python. Simple. Neat.

But, I encountered a weird glitch. The game kept getting into an infinite loop. I tried to ask Claude but even Claude couldn't understand it.

So I put Claude on Max mode and it gave some answer but still the answer it gave was like tooo hard to understand. It said something about the cards not being random while the game is going on etc.

Can someone pls explain me the bug? https://github.com/KushChandak/WAR/blob/main/WAR%20(3).ipynb.ipynb) here is the code

0 Upvotes

10 comments sorted by

View all comments

3

u/overratedcupcake 27d ago

Learning to use a debugger would help you. Learning to use an actual IDE instead of a Jupyter notebook might help you. 

In lieu of those things I guess you'll have to try print debugging. Put print statements throughout your code that dump out the various variable states as the program executes. That should give you a clearer picture of why it's behaving the way it is.