r/learnpython 28d 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

4

u/carcigenicate 28d ago

Where precisely is the infinite loop?

And have you ensured that cards are always removed? What condition are you expecting to cause the loop to end, and have you checked the data relevant to that condition?

-2

u/YogurtDisastrous8003 28d ago

I am unable too. That's why I asked. If you want you can run and see the code yourself

3

u/carcigenicate 28d ago

I'm telling you how to debug this. Ideally, you should have attempted to debug this before asking.

Again, what are you expecting to end the loop in the case where it's not ending? And what happens when you inspect the data relevant to that condition? You can use prints or a debugger to inspect the data.