Getting specific hash in a 2D-Array
I want to get specific hash in a 2D-Array to work with it. However, right now, it's taking the whole relation in consideration. For example, I have six char r's and all of them would move since they are linked to the same instance. Consider my 2D-Array:
Char G and w are predators in this case and their role is to hunt prey, r, to damage them. Take for instance, G, if this predator was adjacent to a prey, it will 'damage' them. In addition, if these predators commit twelve damage to a specific prey, they are supposed to be killed. To check if damage is done, the following code is implemented:
This code will first check if it's adjacent to a prey and basically compute a damage. Since this is a simulation program, it will add up the damage until the specified amount of turns have been satisfied. However, this is not the issue at hand.
The main issue I have is that I want to access one prey instead of all of them because I would want to identify if that specific prey was killed or not. The prey are accessed through a downcast to an instance called Prey:
Is there a way of come about doing this?