getNumberEnemyNeighbors()

AI discussion, ideas, and SDK help.
Post Reply
User avatar
SunTzu
Lux Cartographer
Posts: 1586
Joined: Sat Jan 14, 2006 1:48 am
Location: Maryland

getNumberEnemyNeighbors()

Post by SunTzu » Wed Jul 18, 2007 12:23 pm

getNumberEnemyNeighbors()

Does this list the enemy countries that a country can attack, or does it list the enemy countries that can attack it?

User avatar
Bertrand
Reaper Creator
Posts: 568
Joined: Mon Nov 28, 2005 4:35 pm
Location: Montreal

Post by Bertrand » Wed Jul 18, 2007 3:41 pm

Both, if the map only has standard two-way connections.

Only the former, if the country has one-way connections.

The Lux SDK always uses adjoiningLists - outgoing connections only. If you want the number of countries that can attack you, use boardhelper.getAttackList().size()

User avatar
SunTzu
Lux Cartographer
Posts: 1586
Joined: Sat Jan 14, 2006 1:48 am
Location: Maryland

Post by SunTzu » Wed Jul 18, 2007 4:34 pm

Thanks again Bertrand!

User avatar
SunTzu
Lux Cartographer
Posts: 1586
Joined: Sat Jan 14, 2006 1:48 am
Location: Maryland

Post by SunTzu » Wed Jul 18, 2007 5:23 pm

For future reference, it should be:

BoardHelper.getAttackList().length

User avatar
Bertrand
Reaper Creator
Posts: 568
Joined: Mon Nov 28, 2005 4:35 pm
Location: Montreal

Post by Bertrand » Wed Jul 18, 2007 6:33 pm

To be clear, getAttackList().length() returns the number of countries that have an inbound connection to you. Those countries are not necessarily enemies, they could be yours. If you want the number of enemies that can attack you, a new method is needed that scans the output from getAttackList() and counts the enemy countries.

Post Reply

Who is online

Users browsing this forum: No registered users and 29 guests