More whitespace removal
This commit is contained in:
parent
94029166a7
commit
46ce51c8ff
4 changed files with 37 additions and 39 deletions
|
@ -1,5 +1,5 @@
|
|||
Tools for hacking or generating WML, maps, images, and sounds belong here.
|
||||
Tools for sanity-checking the mainline campaigns and associated data
|
||||
Tools for sanity-checking the mainline campaigns and associated data
|
||||
also belong here.
|
||||
|
||||
== Scripts ==
|
||||
|
@ -23,7 +23,7 @@ the add-on server.
|
|||
|
||||
Experimental tool that can hack a .cfg referring to a mapfile so that
|
||||
all macros with X,Y coordinate pair arguments get their calls transformed
|
||||
in a specified way. Now supports only flipping the map around the Y
|
||||
in a specified way. Now supports only flipping the map around the Y
|
||||
axis, but provides a framework that should make other transformations
|
||||
easy.
|
||||
|
||||
|
@ -69,14 +69,14 @@ Presently this generates a table suitable for wiki inclusion.
|
|||
=== terrain2wiki.rb ===
|
||||
|
||||
A script to create the "Terrain Table" on the TerrainLettersWML wiki page.
|
||||
Run this and splice the outtput into the wiki whenever you add a new
|
||||
Run this and splice the outtput into the wiki whenever you add a new
|
||||
terrain type to mainline.
|
||||
|
||||
== Python API ==
|
||||
|
||||
=== wmltools.py ===
|
||||
|
||||
The main facility in this module is a cross-referencer class.
|
||||
The main facility in this module is a cross-referencer class.
|
||||
It also contains utility methods for working with the data tree.
|
||||
See the header comment of wmltools.py for details
|
||||
|
||||
|
|
|
@ -2,6 +2,6 @@ This is a directory of miscellaneous developer tools for Battle for Wesnoth,
|
|||
mostly to support packaging, code integrity checks, and control of the
|
||||
Wesnoth servers.
|
||||
|
||||
Tools that work on data (WML, maps, images, sounds) no longer belong here.
|
||||
Tools that work on data (WML, maps, images, sounds) no longer belong here.
|
||||
Go to data/tools for those.
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ class GameResult:
|
|||
end_turn = '0'
|
||||
version_string = ''
|
||||
winner_side = '0'
|
||||
|
||||
|
||||
def __init__(self,_ai_config1,_ai_config2,_faction1,_faction2,_map,_test):
|
||||
self.ai_config1 = _ai_config1
|
||||
self.ai_config2 = _ai_config2
|
||||
|
@ -45,10 +45,10 @@ def construct_command_line(cfg,ai1,ai2,f1,f2,map):
|
|||
else:
|
||||
optmap='--scenario='+map
|
||||
|
||||
return wesnoth+' '+options+' '+optmap+' '+ai_config1+' '+ai_config2
|
||||
return wesnoth+' '+options+' '+optmap+' '+ai_config1+' '+ai_config2
|
||||
|
||||
def do_filter(str,substring):
|
||||
n = str.find(substring)
|
||||
n = str.find(substring)
|
||||
if (n>-1):
|
||||
return n,str[n+len(substring):].strip()
|
||||
return n,''
|
||||
|
@ -66,14 +66,14 @@ def run_game(cfg,game_result):
|
|||
str = filter_non_printable(line.strip())
|
||||
n,s = do_filter(str,'info ai/testing: WINNER:')
|
||||
if (n>-1):
|
||||
#print 'AND THE WINNER IS: '+s
|
||||
#print 'AND THE WINNER IS: '+s
|
||||
game_result.winner_side = s
|
||||
game_result.is_success = 'true'
|
||||
continue
|
||||
|
||||
n,s = do_filter(str,'info ai/testing: VERSION:')
|
||||
if (n>-1):
|
||||
#print 'AND THE VERSION IS: '+s
|
||||
#print 'AND THE VERSION IS: '+s
|
||||
game_result.version_string = s
|
||||
n1 = s.rfind('(')
|
||||
n2 = s.rfind(')')
|
||||
|
@ -90,43 +90,43 @@ def run_game(cfg,game_result):
|
|||
|
||||
n,s = do_filter(str,'info ai/testing: GAME_END_TURN:')
|
||||
if (n>-1):
|
||||
#print 'AND THE VICTORY_TURN IS: '+s
|
||||
#print 'AND THE VICTORY_TURN IS: '+s
|
||||
game_result.end_turn = s
|
||||
continue
|
||||
|
||||
n,s = do_filter(str,'info ai/testing: AI_IDENTIFIER1:')
|
||||
if (n>-1):
|
||||
#print 'AND THE AI_IDENTIFIER1 IS: '+s
|
||||
#print 'AND THE AI_IDENTIFIER1 IS: '+s
|
||||
game_result.ai_ident1 = s.strip()
|
||||
continue
|
||||
|
||||
n,s = do_filter(str,'info ai/testing: AI_IDENTIFIER2:')
|
||||
if (n>-1):
|
||||
#print 'AND THE AI_IDENTIFIER2 IS: '+s
|
||||
#print 'AND THE AI_IDENTIFIER2 IS: '+s
|
||||
game_result.ai_ident2 = s.strip()
|
||||
continue
|
||||
|
||||
n,s = do_filter(str,'info ai/testing: FACTION1:')
|
||||
if (n>-1):
|
||||
#print 'AND THE FACTION1 IS: '+s
|
||||
#print 'AND THE FACTION1 IS: '+s
|
||||
game_result.faction1 = s
|
||||
continue
|
||||
|
||||
n,s = do_filter(str,'info ai/testing: FACTION2:')
|
||||
if (n>-1):
|
||||
#print 'AND THE FACTION2 IS: '+s
|
||||
#print 'AND THE FACTION2 IS: '+s
|
||||
game_result.faction2 = s
|
||||
continue
|
||||
|
||||
game_result.duration = time() - start
|
||||
if (game_result.is_success=='false'):
|
||||
print 'Warning: not success!'
|
||||
print '===================='
|
||||
print '===================='
|
||||
print 'stderr:'
|
||||
for line in outerrlines:
|
||||
print filter_non_printable(line.strip())
|
||||
print '===================='
|
||||
|
||||
print '===================='
|
||||
|
||||
return game_result
|
||||
|
||||
def save_result(cfg,game_result):
|
||||
|
@ -152,7 +152,7 @@ def maps(cfg):
|
|||
yield cfg.get('default','map'+`mp`);
|
||||
mp= mp+1
|
||||
except:
|
||||
return
|
||||
return
|
||||
|
||||
def tests(cfg):
|
||||
ai1=cfg.get('default','ai_config1').strip()
|
||||
|
@ -173,7 +173,7 @@ def tests(cfg):
|
|||
else:
|
||||
game_result = GameResult(ai2,ai1,f2,f1,map,'default')
|
||||
yield game_result
|
||||
|
||||
|
||||
# main
|
||||
|
||||
cfg = ConfigParser.ConfigParser()
|
||||
|
@ -182,5 +182,3 @@ cfg.read('ai_test.cfg')
|
|||
for test in tests(cfg):
|
||||
game_result = run_game(cfg,test)
|
||||
save_result(cfg,game_result)
|
||||
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ class GameResult:
|
|||
end_turn = '0'
|
||||
version_string = ''
|
||||
winner_side = '0'
|
||||
|
||||
|
||||
def __init__(self,_ai_config1,_ai_config2,_faction1,_faction2,_map,_test):
|
||||
self.ai_config1 = _ai_config1
|
||||
self.ai_config2 = _ai_config2
|
||||
|
@ -44,11 +44,11 @@ def construct_command_line(cfg,ai1,ai2,f1,f2,map):
|
|||
optmap=''
|
||||
else:
|
||||
optmap='--scenario='+map
|
||||
|
||||
return wesnoth+' '+options+' '+optmap+' '+ai_config1+' '+ai_config2
|
||||
|
||||
return wesnoth+' '+options+' '+optmap+' '+ai_config1+' '+ai_config2
|
||||
|
||||
def do_filter(str,substring):
|
||||
n = str.find(substring)
|
||||
n = str.find(substring)
|
||||
if (n>-1):
|
||||
return n,str[n+len(substring):].strip()
|
||||
return n,''
|
||||
|
@ -66,14 +66,14 @@ def run_game(cfg,game_result):
|
|||
str = filter_non_printable(line.strip())
|
||||
n,s = do_filter(str,'info ai/testing: WINNER:')
|
||||
if (n>-1):
|
||||
print 'AND THE WINNER IS: '+s
|
||||
print 'AND THE WINNER IS: '+s
|
||||
game_result.winner_side = s
|
||||
game_result.is_success = 'true'
|
||||
continue
|
||||
|
||||
n,s = do_filter(str,'info ai/testing: VERSION:')
|
||||
if (n>-1):
|
||||
#print 'AND THE VERSION IS: '+s
|
||||
#print 'AND THE VERSION IS: '+s
|
||||
game_result.version_string = s
|
||||
n1 = s.rfind('(')
|
||||
n2 = s.rfind(')')
|
||||
|
@ -90,43 +90,43 @@ def run_game(cfg,game_result):
|
|||
|
||||
n,s = do_filter(str,'info ai/testing: GAME_END_TURN:')
|
||||
if (n>-1):
|
||||
print 'AND THE VICTORY_TURN IS: '+s
|
||||
print 'AND THE VICTORY_TURN IS: '+s
|
||||
game_result.end_turn = s
|
||||
continue
|
||||
|
||||
n,s = do_filter(str,'info ai/testing: AI_IDENTIFIER1:')
|
||||
if (n>-1):
|
||||
#print 'AND THE AI_IDENTIFIER1 IS: '+s
|
||||
#print 'AND THE AI_IDENTIFIER1 IS: '+s
|
||||
game_result.ai_ident1 = s.strip()
|
||||
continue
|
||||
|
||||
n,s = do_filter(str,'info ai/testing: AI_IDENTIFIER2:')
|
||||
if (n>-1):
|
||||
#print 'AND THE AI_IDENTIFIER2 IS: '+s
|
||||
#print 'AND THE AI_IDENTIFIER2 IS: '+s
|
||||
game_result.ai_ident2 = s.strip()
|
||||
continue
|
||||
|
||||
n,s = do_filter(str,'info ai/testing: FACTION1:')
|
||||
if (n>-1):
|
||||
#print 'AND THE FACTION1 IS: '+s
|
||||
#print 'AND THE FACTION1 IS: '+s
|
||||
game_result.faction1 = s
|
||||
continue
|
||||
|
||||
n,s = do_filter(str,'info ai/testing: FACTION2:')
|
||||
if (n>-1):
|
||||
#print 'AND THE FACTION2 IS: '+s
|
||||
#print 'AND THE FACTION2 IS: '+s
|
||||
game_result.faction2 = s
|
||||
continue
|
||||
|
||||
game_result.duration = time() - start
|
||||
if (game_result.is_success=='false'):
|
||||
print 'Warning: not success!'
|
||||
print '===================='
|
||||
print '===================='
|
||||
print 'stderr:'
|
||||
for line in outerrlines:
|
||||
print filter_non_printable(line.strip())
|
||||
print '===================='
|
||||
|
||||
print '===================='
|
||||
|
||||
return game_result
|
||||
|
||||
def save_result(cfg,log_file,game_result):
|
||||
|
@ -143,7 +143,7 @@ def maps(cfg):
|
|||
yield cfg.get('default','map'+`mp`);
|
||||
mp= mp+1
|
||||
except:
|
||||
return
|
||||
return
|
||||
|
||||
def tests(cfg):
|
||||
ai1=cfg.get('default','ai_config1').strip()
|
||||
|
@ -164,7 +164,7 @@ def tests(cfg):
|
|||
else:
|
||||
game_result = GameResult(ai2,ai1,f2,f1,map,'default')
|
||||
yield game_result
|
||||
|
||||
|
||||
# main
|
||||
|
||||
cfg = ConfigParser.ConfigParser()
|
||||
|
@ -175,4 +175,4 @@ log_file.write('"ai_config1"'+', '+'"ai_config2"'+', '+'"ai_ident1"'+', '+'"ai_i
|
|||
log_file.flush();
|
||||
for test in tests(cfg):
|
||||
game_result = run_game(cfg,test)
|
||||
save_result(cfg,log_file,game_result)
|
||||
save_result(cfg,log_file,game_result)
|
||||
|
|
Loading…
Add table
Reference in a new issue