Can bots read the .luxb file of the current map?

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

Can bots read the .luxb file of the current map?

Post by SunTzu » Wed Aug 29, 2007 11:12 am

Is there a way for the bot to read the .luxb file of the current map?

User avatar
GregM
Luxer
Posts: 252
Joined: Wed Jun 01, 2005 4:33 pm

Post by GregM » Wed Aug 29, 2007 12:10 pm

If you know the name of the map you're playing, you can do it like this:

Code: Select all

File agentDir = new File(board.getAgentPath());
File supportDir = agentDir.getParent();
File boardsDir = new File(supportDir, "Boards");
File savedDir = new File(themeDir, "Saved");
File desiredMapLuxb = new File(savedDir, "DesiredMap.luxb");

BufferedReader reader = new BufferedReader(new FileReader(desiredMapLuxb)); 

//Now you can read the file

Unfortunately I don't think its simple to tell what map you're playing. Perhaps Dustin will be nice and implement Board.getMapName() (and maybe Board.getMapVersion() too, while he's at it) but in the meantime I think you've got to resort to other methods.

One possibility is to compute a value for each map and then store the corresponding values for the maps you want to recognize. For example, you might compute your value by computing for each each country the product of its country ID, continent ID, and the ID's of all its neighbors and then summing all of these. Then, if you want to be able to recognize Classic, compute the value for Classic and code it into the bot.

What information can you get from the .luxb file that you can't get normally?

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

Post by SunTzu » Wed Aug 29, 2007 12:50 pm

Thanks for the info Greg!

Any chance we can get the map name Dustin?

See here for more details on why I would want to read the .luxb file.

User avatar
dustin
Lux Creator
Lux Creator
Posts: 10999
Joined: Thu May 15, 2003 2:01 am
Location: Cascadia
Contact:

Post by dustin » Fri Nov 21, 2008 8:39 pm

Board.getMapTitle() will give you a name for the map.

Post Reply

Who is online

Users browsing this forum: No registered users and 27 guests