Results 1 to 1 of 1
- 03-18-2011, 07:24 AM #1
Member
- Join Date
- Feb 2011
- Posts
- 17
- Rep Power
- 0
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?
Thank you.
Ben
Similar Threads
-
How to: Select specific array indices?
By louist in forum New To JavaReplies: 3Last Post: 03-07-2011, 10:21 PM -
Hash
By sandy1028 in forum New To JavaReplies: 4Last Post: 04-17-2009, 10:36 AM -
Hash Map
By rekha in forum New To JavaReplies: 1Last Post: 03-21-2009, 01:00 PM -
Hash Values ???
By MuslimCoder in forum New To JavaReplies: 6Last Post: 01-16-2009, 04:26 AM -
how do i print a specific txt file on a specific printer
By nikhilbhat in forum New To JavaReplies: 2Last Post: 11-08-2008, 10:40 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks