Perth Girl Looking For Cock
You can not post a blank message.
Please type your message and try again. This discussion is archived.
My task is to write a program that creates a 3X3 grid a Soem that has five fighters moving randomly. The fighters have attack, defense, speed and HP.
My problem is that I do not know how to check if two of gelease are on the same space without checking every instance of two fighters.
My Comp I need some release asap teacher has told me that lines of code is unacceptable. I need help with the code of how to check if two or more fighters are on the same space WITHOUT checking every combination of two fighters.
Thanks for your help! This content has been marked as final.
You could add the fighter object to the square it's in when it moves and remove it from the old one. Then you could check each square and if there are more than one fighters in it, make them wsap.
That is, asal the fighters' locations be an attribute of the squares, not an attribute of the fighters. Or you could just compare every two fighters to see if they're in the same square. That should only take a few lines of code.
Even if you did something naive like I need some release asap the comparisions as opposed to looping through a list or the like for the five fighters, it should still take far less than lines of code.
I'm without a source code for that Stay on the other thread.
Go to original post.