Tag Info

New answers tagged


The code looks mostly fine, although the more pythonic way to write it would be def musica(): if pygame.mixer.music,get_busy(): print("Music is playing") else: music.play(loops=-1) This could also eliminate any issues of it going into both if statements


I'm not familiar with pygame, but likely it does not like the image being repeatedly rotated and blitted onto itself. Check out if this answer on StackOverflow works for you. Explanation Rotating an image is inaccurate. Unless you rotate exactly by multiples of 90 degrees, you never get an exact pixel-to-pixel mapping. In other words, you loose a small ...


Sounds like you're after something like a flood fill algorithm. Basically, something like the following algorithm (you can see other examples on the wikipedia page): 1. Add your castle to the Checklist 2. Get the first item from the Checklist 3. For each surrounding position 4. If not on Complete list 5. If `0` add to Checklist 6. If `1` ...


In my experience with AI planning, copying the state was indeed very slow and your suggested idea (maintaining a single copy of the state and undoing the actions when you go "up the tree") worked much better. But that really depends on the size of your state and language you use: in C++ you could probably use custom allocators to fit the whole state into a ...

Top 50 recent answers are included