cz.cuni.amis.pogamut.ut2004.tournament.deathmatch
Class UT2004DeathMatch1v1

Package class diagram package UT2004DeathMatch1v1
java.lang.Object
  extended by cz.cuni.amis.pogamut.ut2004.tournament.deathmatch.UT2004DeathMatch1v1
All Implemented Interfaces:
Runnable, Callable<UT2004DeathMatchResult>

public class UT2004DeathMatch1v1
extends Object
implements Callable<UT2004DeathMatchResult>, Runnable

Performs 1v1 death-match for two Pogamut bots (no native bots here).

You may run it inside thread by invoking new Thread(ut2004DeathMatch1v1).start() or use with ThreadPoolExecutor as it is implementing Callable.

But you will usually want just to execute it using call().

Encapsulates classes: UT2004DeathMatch, UT2004DeathMatchConfig, UT2004BotConfig and UCCWrapperConf.

If you want to know how all instanes of UT2004DeathMatch configuration are setup, see configure1Vs1() code.

Author:
Jimmy

Constructor Summary
UT2004DeathMatch1v1()
          Parameter-less constructor, don't forget to initialize everything!
UT2004DeathMatch1v1(String matchName)
          Match-name only constructor, don't forget to initialize everything!
UT2004DeathMatch1v1(String unrealHome, String mapName, String bot1Name, String bot1JarPath, String bot2Name, String bot2JarPath)
          Initializes all needed fields for combat of 2 bots.
 
Method Summary
 UT2004DeathMatchResult call()
           
 void cleanUp()
          Removes directory with match results, called automatically in run().
protected  UT2004DeathMatchConfig configure1Vs1()
          Contains main code that setups the UT2004DeathMatchConfig, UT2004BotConfig and UCCWrapper instances (it might be interesting for you to check the code for yourself if you wish to customize it further...).
 UT2004DeathMatch createMatch()
          Creates new instance of UT2004DeathMatch with desired configuration + validates it (i.e., if it won't throw an exception you may be sure, that the UT2004DeathMatch instance is correctly configured).
 String getBot1JarPath()
          Used as UT2004BotExecutionConfig.setPathToBotJar(String) for the first bot.
 String getBot1Name()
          Used as UT2004BotConfig.setBotId(String) for the first bot.
 String getBot2JarPath()
          Used as UT2004BotExecutionConfig.setPathToBotJar(String) for the second bot.
 String getBot2Name()
          Used as UT2004BotConfig.setBotId(String) for the second bot.
 Throwable getException()
          If run() terminates with an exception, it will be made available through this getter.
 int getFragLimit()
          Used as UT2004DeathMatchConfig.setFragLimit(int).
 cz.cuni.amis.pogamut.base.utils.logging.LogCategory getLog()
          Logger used for outputting info about the match.
 String getMapName()
          Used as UCCWrapperConf.setMapName(String).
 String getMatchName()
          Used as UT2004MatchConfig.setMatchId(String).
 String getOutputDir()
          Used as UT2004DeathMatchConfig.setOutputDirectory(File).
 UT2004DeathMatchResult getResult()
          Last result of the match.
 int getTimeLimitInMinutes()
          Used as UT2004DeathMatchConfig.setTimeLimit(int).
 String getUnrealHome()
          Used as UCCWrapperConf.setMapName(String).
 void run()
          Executes the match.
 UT2004DeathMatch1v1 setBot1JarPath(String bot1JarPath)
           
 UT2004DeathMatch1v1 setBot1Name(String bot1Name)
           
 UT2004DeathMatch1v1 setBot2JarPath(String bot2JarPath)
           
 UT2004DeathMatch1v1 setBot2Name(String bot2Name)
           
 UT2004DeathMatch1v1 setFragLimit(int fragLimit)
           
 UT2004DeathMatch1v1 setHumanLikeLogEnabled(boolean humanLikeLogEnabled)
           
 void setLog(cz.cuni.amis.pogamut.base.utils.logging.LogCategory log)
          Sets logger used for outputting info about the match.
 UT2004DeathMatch1v1 setMapName(String mapName)
           
 UT2004DeathMatch1v1 setMatchName(String matchName)
           
 UT2004DeathMatch1v1 setOutputDir(String outputDir)
           
 UT2004DeathMatch1v1 setTimeLimitInMinutes(int timeLimitInMinutes)
           
 UT2004DeathMatch1v1 setUnrealHome(String unrealHome)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UT2004DeathMatch1v1

public UT2004DeathMatch1v1()
Parameter-less constructor, don't forget to initialize everything!


UT2004DeathMatch1v1

public UT2004DeathMatch1v1(String matchName)
Match-name only constructor, don't forget to initialize everything!


UT2004DeathMatch1v1

public UT2004DeathMatch1v1(String unrealHome,
                           String mapName,
                           String bot1Name,
                           String bot1JarPath,
                           String bot2Name,
                           String bot2JarPath)
Initializes all needed fields for combat of 2 bots.

Used time limit: 20 minutes,

Used frag limit: 20

Recommended mapName: DM-1on1-Albatross

Parameters:
unrealHome -
mapName -
bot1Name -
bot1JarPath -
bot2Name -
bot2JarPath -
Method Detail

getLog

public cz.cuni.amis.pogamut.base.utils.logging.LogCategory getLog()
Logger used for outputting info about the match.

If you want to output stuff to console, use LogCategory.addConsoleHandler().

Returns:

getFragLimit

public int getFragLimit()
Used as UT2004DeathMatchConfig.setFragLimit(int).

Returns:

getTimeLimitInMinutes

public int getTimeLimitInMinutes()
Used as UT2004DeathMatchConfig.setTimeLimit(int).

Returns:

getMatchName

public String getMatchName()
Used as UT2004MatchConfig.setMatchId(String).

Returns:

getBot1Name

public String getBot1Name()
Used as UT2004BotConfig.setBotId(String) for the first bot.

Returns:

getBot1JarPath

public String getBot1JarPath()
Used as UT2004BotExecutionConfig.setPathToBotJar(String) for the first bot.

Returns:

getBot2Name

public String getBot2Name()
Used as UT2004BotConfig.setBotId(String) for the second bot.

Returns:

getBot2JarPath

public String getBot2JarPath()
Used as UT2004BotExecutionConfig.setPathToBotJar(String) for the second bot.

Returns:

getUnrealHome

public String getUnrealHome()
Used as UCCWrapperConf.setMapName(String).

Returns:

getMapName

public String getMapName()
Used as UCCWrapperConf.setMapName(String).

Returns:

getOutputDir

public String getOutputDir()
Used as UT2004DeathMatchConfig.setOutputDirectory(File).

Returns:

getResult

public UT2004DeathMatchResult getResult()
Last result of the match. Available after first successful execution of run().

Returns:

getException

public Throwable getException()
If run() terminates with an exception, it will be made available through this getter.

Returns:

setLog

public void setLog(cz.cuni.amis.pogamut.base.utils.logging.LogCategory log)
Sets logger used for outputting info about the match.

Parameters:
log -

setFragLimit

public UT2004DeathMatch1v1 setFragLimit(int fragLimit)

setTimeLimitInMinutes

public UT2004DeathMatch1v1 setTimeLimitInMinutes(int timeLimitInMinutes)

setMatchName

public UT2004DeathMatch1v1 setMatchName(String matchName)

setBot1Name

public UT2004DeathMatch1v1 setBot1Name(String bot1Name)

setBot1JarPath

public UT2004DeathMatch1v1 setBot1JarPath(String bot1JarPath)

setBot2Name

public UT2004DeathMatch1v1 setBot2Name(String bot2Name)

setBot2JarPath

public UT2004DeathMatch1v1 setBot2JarPath(String bot2JarPath)

setUnrealHome

public UT2004DeathMatch1v1 setUnrealHome(String unrealHome)

setMapName

public UT2004DeathMatch1v1 setMapName(String mapName)

setOutputDir

public UT2004DeathMatch1v1 setOutputDir(String outputDir)

setHumanLikeLogEnabled

public UT2004DeathMatch1v1 setHumanLikeLogEnabled(boolean humanLikeLogEnabled)

cleanUp

public void cleanUp()
Removes directory with match results, called automatically in run().


configure1Vs1

protected UT2004DeathMatchConfig configure1Vs1()
Contains main code that setups the UT2004DeathMatchConfig, UT2004BotConfig and UCCWrapper instances (it might be interesting for you to check the code for yourself if you wish to customize it further...).

Returns:

createMatch

public UT2004DeathMatch createMatch()
Creates new instance of UT2004DeathMatch with desired configuration + validates it (i.e., if it won't throw an exception you may be sure, that the UT2004DeathMatch instance is correctly configured).

Returns:

run

public void run()
Executes the match. It first cleanUp(), than it configures UT2004DeathMatch via createMatch() and UT2004DeathMatch.execute()s it.

If no exception occurs during the match (== match will successfully finish), match result will be available through getResult().

If exception occurs (due to whatever reason), this exception will be available through getException().

Specified by:
run in interface Runnable
Throws:
cz.cuni.amis.utils.exception.PogamutException - wraps any exception into this one

call

public UT2004DeathMatchResult call()
                            throws Exception
Specified by:
call in interface Callable<UT2004DeathMatchResult>
Throws:
Exception


Copyright © 2012 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.