Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
...
  • 6 commits
  • 9 files changed
  • 0 commit comments
  • 1 contributor
Commits on Nov 30, 2011
@kruton Update contest files from updated zip 58f5744
@kruton Revert "Move config files to directories"
The original contest files were updated to fix this.

This reverts commit ae6ea31.
a26c2bc
@kruton Revert "Fix agent path choosing"
The original contest files were fixed, so revert this as well.

This reverts commit 753ac8e.
dfd1d85
@kruton Merge branch 'original' 4b096dd
@kruton Add in new agents and layouts 8229bad
@kruton Merge branch 'original' df5de9c
View
7 teams/BaselineAgents/config.py → baselineAgentsConfig.py
@@ -35,14 +35,13 @@
"""
# Alpha-Numeric only
-TeamName = 'OurTeamName'
+TeamName = 'BaselineAgents'
# Filename.FactoryClassName (CASE-sensitive)
-#AgentFactory = 'mattsAgents.MattsAgents' # use this to test location inference, with python capture.py -k 3 -l fastCapture
AgentFactory = 'baselineAgents.BaselineAgents'
-Partners = ['Matt Barton', 'Kenny Root', 'Steve Hall']
+Partners = ['Partner Names']
AgentArgs = {'first':'offense', 'second':'defense', 'third':'offense'}
-NotifyList = ['mbarton@stanford.edu','rootk@stanford.edu', 'seh@stanford.edu']
+NotifyList = ['member1@stanford.edu','member2@stanford.edu', 'member3@stanford.edu']
View
56 capture.py
@@ -587,10 +587,10 @@ def readCommand( argv ):
"""
parser = OptionParser(usageStr)
- parser.add_option('-r', '--red', help=default('Red team'),
- default='teams/baselineAgents/')
- parser.add_option('-b', '--blue', help=default('Blue team'),
- default='teams/baselineAgents/')
+ parser.add_option('-r', '--red', help=default('Red team'), dest='redconf',
+ default='baselineAgents')
+ parser.add_option('-b', '--blue', help=default('Blue team'), dest='blueconf',
+ default='baselineAgents')
parser.add_option('--redOpts', help=default('Options for red team (e.g. first=keys)'),
default='')
parser.add_option('--blueOpts', help=default('Options for blue team (e.g. first=keys)'),
@@ -666,10 +666,10 @@ def readCommand( argv ):
redArgs['numTraining'] = options.numTraining
blueArgs['numTraining'] = options.numTraining
nokeyboard = options.textgraphics or options.quiet or options.numTraining > 0
- print '\nRed team %s with %s:' % (options.red, redArgs)
- redAgents = loadAgents(True, options.red, nokeyboard, redArgs)
- print '\nBlue team %s with %s:' % (options.blue, blueArgs)
- blueAgents = loadAgents(False, options.blue, nokeyboard, blueArgs)
+ print '\nRed team %s with %s:' % (options.redconf, redArgs)
+ redAgents = loadAgents(True, options.redconf, nokeyboard, redArgs)
+ print '\nBlue team %s with %s:' % (options.blueconf, blueArgs)
+ blueAgents = loadAgents(False, options.blueconf, nokeyboard, blueArgs)
args['agents'] = sum([list(el) for el in zip(redAgents, blueAgents)],[]) # list of agents
# Choose a layout
@@ -710,37 +710,51 @@ def loadAgents(isRed, factory, textgraphics, cmdLineArgs):
# Looks through all pythonPath Directories for the right module
import os
dir = ''
-
- oldsyspath = sys.path
-
- sys.path.insert(0, factory)
# Pick the dir with our team info
path_append = None
+
dir = 'src/teams'
if os.path.isdir(dir):
path_append = dir
- sys.path.insert(0, os.getcwd() + path_append)
+ sys.path.append(os.getcwd() + path_append)
else:
dir = 'teams/'
if os.path.isdir(dir):
path_append = dir
- sys.path.insert(0, os.getcwd() + path_append)
+ sys.path.append(os.getcwd() + path_append)
else:
dir = 'src/'
if os.path.isdir(dir):
path_append = dir
- sys.path.insert(0, os.getcwd() + path_append)
+ sys.path.append(os.getcwd() + path_append)
+
+ if os.path.isdir(factory):
+ sys.path.append(os.getcwd() + factory)
+
+ if path_append is not None:
+ if os.path.isdir(path_append + factory):
+ sys.path.append(os.getcwd() + path_append + factory)
try:
- conf = __import__("config")
+ factoryName = factory
+ conf = __import__(factoryName + "Config")
conf = reload(conf)
except ImportError:
- print 'Error: The team "' + factory + '" config could not be loaded! '
- traceback.print_exc()
- return [None for i in range(3)]
- finally:
- sys.path = oldsyspath
+ try:
+ # Try lower case first character
+ factoryName = factory[0].lower() + factory[1:]
+ conf = __import__(factoryName + "Config")
+ conf = reload(conf)
+ except ImportError:
+ try:
+ conf = __import__("config")
+ conf = reload(conf)
+ except ImportError:
+ print 'Error: The team "' + factory + '" config could not be loaded! '
+ print 'Config file load attempted on "' + factoryName + 'Config.py' + '" and "config.py".'
+ traceback.print_exc()
+ return [None for i in range(3)]
factory = factory + "." + conf.AgentFactory
args = dict(conf.AgentArgs)
View
2 captureAgents.py
@@ -306,7 +306,7 @@ def getNextPositionAsInt(self, gameState, action):
"""
if action in self.getLegalActions(gameState):
pos = self.getPosition(gameState)
- dx, dy = self.getDirectionalVector(self, action)
+ dx, dy = self.getDirectionalVector(action)
return (int(pos[0]+dx),int(pos[1]+dy))
else:
return (None, None)
View
0 teams/MattsAgents/config.py → config.py
File renamed without changes.
View
22 layouts/random20164321Capture.lay
@@ -0,0 +1,22 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% % %.% %.% %.% . % %6%
+% . ..% % %. .% % %%%%%%%%.% % 4%
+%%%%%%%%%%%.%%%%%% % % % . . % %2%
+%. . % %. %%% %%%%%%%% %
+%% %%%%%%%%%%. % % . ...% %.%
+%. . . % %%%%%%%%%%%%%.%% %
+%% %%%%%%%%%%..% %%% %.. . . .% %
+% .. . %.% % %%% %%%%%%%%%%%% %
+% %%%%%%%% %%%%% % . % ..%.. .% %
+% %.o o ..% % % % %%% %%%%%%% %% %
+% %% %%%%%%% %%% % % % %.. o o.% %
+% %. ..%.. % . % %%%%% %%%%%%%% %
+% %%%%%%%%%%%% %%% % %.% . .. %
+% %. . . ..% %%% %..%%%%%%%%%% %%
+% %%.%%%%%%%%%%%%% % . . .%
+%.% %... . % % .%%%%%%%%%% %%
+% %%%%%%%% %%% .% % . .%
+%1% % . . % % % %%%%%%.%%%%%%%%%%%
+%3 % %.%%%%%%%% % %. .% % %.. . %
+%5% % . %.% %.% %.% % %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
View
22 layouts/random70179121Capture.lay
@@ -0,0 +1,22 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %. .%.% .% %.%.%. % %6%
+% % %.% %.. % % .. % % %4%
+%%%%%% %%%%%%%%%.%%% %%%%%% %%%%%%%%%2%
+%. . .%. %.% % % %... . %
+% % % %.% .% . . % . .%
+%o%%%% %%%.%%% %% % %%%%%%%%% % .%% %%%%
+% %.. % . % % %..% . %.%
+% %%%%%% % %. % %o%% %.%
+% % ..% %% % %% % % %%. % %% %% % %
+% % % %% % .% %% . % % % %%. %. % % %
+% % % .% .%% % % % . %% %. % %% % % %
+% % %% %% % .%% % % %% % %% %.. % %
+%.% %%o% % .% % %%%%%% %
+%.% . %..% % % . % ..% %
+%%%% %%. % %%%%%%%%% % %% %%%.%%% %%%%o%
+%. . % . . %. %.% % % %
+% . ...% % % %.% .%. . .%
+%1%%%%%%%%% %%%%%% %%%.%%%%%%%%% %%%%%%
+%3% % % .. % % ..% %.% % %
+%5% % .%.%.% %. %.%. .% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
View
22 layouts/upgradeCapture.lay
@@ -0,0 +1,22 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% % . . . .% . . %.%.% 6%
+% o%%% %%%%%%% % %. .%% .o % % 4%
+% % ..%% %% %. %% %. % % 2%
+% %%%%%%%%%%%%%% % .%. %%%%% %%% %%%%
+% % % . % %%%% %% %.% ..% %
+%.% % % . %. %.%. % .% .%
+%%%%%%%% %%% % %%%%%% %%%%% % . %%% %% %%
+%.. . % %. %.%.% % .% .%
+%%%% %%%%%% % % %%%% % .%%%%% %%%%%% %
+% %..% % % % % .%.%
+%.%. % % % % %..% %
+% %%%%%% %%%%%. % %%%% % % %%%%%% %%%%
+%. %. % %.%.% .% % . ..%
+%% %% %%% . % %%%%% %%%%%% % %%% %%%%%%%%
+%. %. % .%.% .% . % % %.%
+% %.. %.% %% %%%% % . % % %
+%%%% %%% %%%%% .%. % %%%%%%%%%%%%%% %
+%1 % % .% %% .% %% %%.. % %
+%3 % % o. %%. .% % %%%%%%% %%%o %
+%5 %.%.% . . %. . . . % %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
View
BIN upgradedAgents.pyc
Binary file not shown.
View
48 upgradedAgentsConfig.py
@@ -0,0 +1,48 @@
+# config.py
+# ---------
+# Licensing Information: Please do not distribute or publish solutions to this
+# project. You are free to use and extend these projects for educational
+# purposes. The Pacman AI projects were developed at UC Berkeley, primarily by
+# John DeNero (denero@cs.berkeley.edu) and Dan Klein (klein@cs.berkeley.edu).
+# For more info, see http://inst.eecs.berkeley.edu/~cs188/sp09/pacman.html
+
+"""
+-----------------------
+ Agent Configuration
+-----------------------
+
+Settings:
+
+ - TeamName (string)
+ The official name of your team. Names
+ must be alpha-numeric only. Agents with
+ invalid team names will not execute.
+
+ - AgentFactory (string)
+ The fully qualified name of the agent
+ factory to execute.
+
+ - AgentArgs (dict of string:string)
+ Arguments to pass to the agent factory
+
+ - NotifyList (list of strings)
+ A list of email addresses to notify
+ to when this agent competes.
+ - Partners (list of strings)
+ Group members who have contributed to
+ this agent code and design.
+
+"""
+
+# Alpha-Numeric only
+TeamName = 'Upgraded Agents'
+
+# Filename.FactoryClassName (CASE-sensitive)
+AgentFactory = 'upgradedAgents.UpgradedAgents'
+
+Partners = []
+
+#AgentArgs = {'first':'offense', 'second':'defense'}
+AgentArgs = {}
+
+NotifyList = []

No commit comments for this range

Something went wrong with that request. Please try again.