--- /dev/null
+#!/bin/bash
+
+# bundle-agent.sh
+# progcomp
+#
+# Written by Daniel Axtens <
[email protected]> for the UCC Programming Competition in 2010.
+# Licensed under an MIT-style license: see the LICENSE file for details.
+
+# a candidate for porting to python.
+
+# put ourselves in SRCROOT - src/
+# this assumes we are in the src/link directory.
+cd `dirname $0`/..
+
+# begin script
+cat << __EOF__
+This script takes the code that you have written for UCC::ProgComp 2010 and
+bundles it up as an agent that you can test. This script is not needed for code
+written in Python.
+__EOF__
+
+
+# select language
+lang=0
+
+while ([ $lang != 1 ] && [ $lang != 2 ]) do {
+
+ cat << __EOF__
+Is your agent written in:
+(1) C
+(2) another language (UNSUPPORTED)
+__EOF__
+
+ read -p "Enter 1 or 2: " lang
+
+} done;
+
+# C bots
+if ([ $lang == 1 ]) then
+ echo
+ echo "Preparing a C bot."
+ echo
+
+ echo "Where is your .c file?"
+ echo "Provide the full path, including the agent file and the .c"
+ echo "Give paths relative to the src/ directory."
+ echo "WARNING: will overwrite \'agent name\'.py if it exists"
+
+ read -p "Path: " path
+
+ location=`dirname $path`
+ name=`basename $path .c`
+
+ cat > ${location}/${name}.py << __EOF__
+# ${name}.py - a C bot shell generated by `basename $0` for UCC::ProgComp 2010
+
+from link.cAgent import cAgent
+
+class ${name} (cAgent):
+ def __init__ (self):
+ cAgent.__init__(self, "${location}/${name}")
+__EOF__
+
+
+
+# Custom bots
+elif ([ $lang == 2 ]) then
+ echo
+ echo "Preparing a custom bot."
+ echo
+
+ echo "What is the name of your bot?"
+
+ read -p "Name: " name
+
+ echo
+ echo "Enter the command required to spawn your bot."
+ echo "Give paths relative to the src/ directory."
+
+ read -p "Command: " cmd
+
+ echo
+ echo "Into which directory should I put the resultant python module?"
+ echo "(again, give paths relative to src/)"
+ echo "WARNING: will overwrite ${name}.py if it exists"
+
+ read -p "Location: " location
+
+ cat > ${location}/${name}.py << __EOF__
+# ${name}.py - a custom bot shell generated by `basename $0` for UCC::ProgComp 2010
+# calls "${cmd}" to invoke the bot
+
+from link.externAgent import externAgent
+
+class ${name} (externAgent):
+ def __init__ (self):
+ externAgent.__init__(self, "${cmd}")
+__EOF__
+
+
+fi
+
+### Finish up
+echo
+echo "${name}.py created."
+echo
+echo "Include your bot with:"
+
+#there must be a nicer way to do this. possibly by using python
+#part of the horror is trying to deal with location possibly having a trailing
+#slash, and possibly not having one. *sigh*
+pythonpath=`sed 's:/:.:g' << __EOF__
+$(dirname ${location}/${name}).${name}
+__EOF__
+`
+
+echo " from ${pythonpath} import ${name}"
+echo "Then make sure the Agents list includes ${name}"
+echo
+echo "Good luck!"
\ No newline at end of file
objects = {
/* Begin PBXFileReference section */
+ 22CA010611D9BD51001ECDEF /* bundle-agent.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = "bundle-agent.sh"; path = "link/bundle-agent.sh"; sourceTree = "<group>"; };
+ 22CA010711D9C52B001ECDEF /* cAgent.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; name = cAgent.py; path = link/cAgent.py; sourceTree = "<group>"; };
22CAFEEA11D84076001ECDEF /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE; sourceTree = "<group>"; };
22CAFEEB11D84076001ECDEF /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
22CAFEEC11D84076001ECDEF /* rpsconst.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = rpsconst.py; sourceTree = "<group>"; };
22CAFEF011D84076001ECDEF /* uccProgComp.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = uccProgComp.py; sourceTree = "<group>"; };
22CAFF7B11D840E3001ECDEF /* __init__.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; name = __init__.py; path = link/__init__.py; sourceTree = "<group>"; };
22CAFF7C11D840E3001ECDEF /* externAgent.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; name = externAgent.py; path = link/externAgent.py; sourceTree = "<group>"; };
- 22CAFF7E11D840E3001ECDEF /* __init__.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = __init__.py; sourceTree = "<group>"; };
- 22CAFF8011D840E3001ECDEF /* ANSI.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = ANSI.py; sourceTree = "<group>"; };
- 22CAFF8211D840E3001ECDEF /* ANSI.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = ANSI.html; sourceTree = "<group>"; };
- 22CAFF8311D840E3001ECDEF /* clean.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = clean.css; sourceTree = "<group>"; };
- 22CAFF8411D840E3001ECDEF /* email.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = email.png; sourceTree = "<group>"; };
- 22CAFF8511D840E3001ECDEF /* examples.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = examples.html; sourceTree = "<group>"; };
- 22CAFF8611D840E3001ECDEF /* fdpexpect.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = fdpexpect.html; sourceTree = "<group>"; };
- 22CAFF8711D840E3001ECDEF /* FSM.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = FSM.html; sourceTree = "<group>"; };
- 22CAFF8811D840E3001ECDEF /* index.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = index.html; sourceTree = "<group>"; };
- 22CAFF8911D840E3001ECDEF /* index.template.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = index.template.html; sourceTree = "<group>"; };
- 22CAFF8A11D840E3001ECDEF /* pexpect.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = pexpect.html; sourceTree = "<group>"; };
- 22CAFF8B11D840E3001ECDEF /* pxssh.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = pxssh.html; sourceTree = "<group>"; };
- 22CAFF8C11D840E3001ECDEF /* screen.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = screen.html; sourceTree = "<group>"; };
- 22CAFF8E11D840E3001ECDEF /* astat.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = astat.py; sourceTree = "<group>"; };
- 22CAFF8F11D840E3001ECDEF /* bd_client.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = bd_client.py; sourceTree = "<group>"; };
- 22CAFF9011D840E3001ECDEF /* bd_serv.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = bd_serv.py; sourceTree = "<group>"; };
- 22CAFF9111D840E3001ECDEF /* cgishell.cgi */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = cgishell.cgi; sourceTree = "<group>"; };
- 22CAFF9211D840E3001ECDEF /* chess.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = chess.py; sourceTree = "<group>"; };
- 22CAFF9311D840E3001ECDEF /* chess2.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = chess2.py; sourceTree = "<group>"; };
- 22CAFF9411D840E3001ECDEF /* chess3.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = chess3.py; sourceTree = "<group>"; };
- 22CAFF9511D840E3001ECDEF /* df.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = df.py; sourceTree = "<group>"; };
- 22CAFF9611D840E3001ECDEF /* fix_cvs_files.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = fix_cvs_files.py; sourceTree = "<group>"; };
- 22CAFF9711D840E3001ECDEF /* ftp.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = ftp.py; sourceTree = "<group>"; };
- 22CAFF9811D840E3001ECDEF /* hive.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = hive.py; sourceTree = "<group>"; };
- 22CAFF9911D840E3001ECDEF /* log_69.80.212.10 */ = {isa = PBXFileReference; lastKnownFileType = file; path = log_69.80.212.10; sourceTree = "<group>"; };
- 22CAFF9A11D840E3001ECDEF /* log_69.80.212.11 */ = {isa = PBXFileReference; lastKnownFileType = file; path = log_69.80.212.11; sourceTree = "<group>"; };
- 22CAFF9B11D840E3001ECDEF /* monitor.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = monitor.py; sourceTree = "<group>"; };
- 22CAFF9C11D840E3001ECDEF /* passmass.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = passmass.py; sourceTree = "<group>"; };
- 22CAFF9D11D840E3001ECDEF /* python.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = python.py; sourceTree = "<group>"; };
- 22CAFF9E11D840E3001ECDEF /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
- 22CAFF9F11D840E3001ECDEF /* rippy.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = rippy.py; sourceTree = "<group>"; };
- 22CAFFA011D840E3001ECDEF /* script.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = script.py; sourceTree = "<group>"; };
- 22CAFFA111D840E3001ECDEF /* ssh_session.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = ssh_session.py; sourceTree = "<group>"; };
- 22CAFFA211D840E3001ECDEF /* ssh_tunnel.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = ssh_tunnel.py; sourceTree = "<group>"; };
- 22CAFFA311D840E3001ECDEF /* sshls.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = sshls.py; sourceTree = "<group>"; };
- 22CAFFA411D840E3001ECDEF /* table_test.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = table_test.html; sourceTree = "<group>"; };
- 22CAFFA511D840E3001ECDEF /* topip.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = topip.py; sourceTree = "<group>"; };
- 22CAFFA611D840E3001ECDEF /* uptime.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = uptime.py; sourceTree = "<group>"; };
- 22CAFFA711D840E3001ECDEF /* fdpexpect.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = fdpexpect.py; sourceTree = "<group>"; };
- 22CAFFA811D840E3001ECDEF /* FSM.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = FSM.py; sourceTree = "<group>"; };
- 22CAFFA911D840E3001ECDEF /* INSTALL */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = INSTALL; sourceTree = "<group>"; };
- 22CAFFAA11D840E3001ECDEF /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE; sourceTree = "<group>"; };
- 22CAFFAB11D840E3001ECDEF /* pexpect.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = pexpect.py; sourceTree = "<group>"; };
- 22CAFFAD11D840E3001ECDEF /* PKG-INFO */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "PKG-INFO"; sourceTree = "<group>"; };
- 22CAFFAE11D840E3001ECDEF /* pxssh.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = pxssh.py; sourceTree = "<group>"; };
- 22CAFFAF11D840E3001ECDEF /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
- 22CAFFB011D840E3001ECDEF /* screen.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = screen.py; sourceTree = "<group>"; };
- 22CAFFB111D840E3001ECDEF /* setup.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = setup.py; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXGroup section */
22CAFF7711D840CB001ECDEF /* link */ = {
isa = PBXGroup;
children = (
+ 22CA010711D9C52B001ECDEF /* cAgent.py */,
22CAFF7B11D840E3001ECDEF /* __init__.py */,
22CAFF7C11D840E3001ECDEF /* externAgent.py */,
- 22CAFF7D11D840E3001ECDEF /* pexpect */,
+ 22CA010611D9BD51001ECDEF /* bundle-agent.sh */,
);
name = link;
sourceTree = "<group>";
};
- 22CAFF7D11D840E3001ECDEF /* pexpect */ = {
- isa = PBXGroup;
- children = (
- 22CAFF7E11D840E3001ECDEF /* __init__.py */,
- 22CAFF8011D840E3001ECDEF /* ANSI.py */,
- 22CAFF8111D840E3001ECDEF /* doc */,
- 22CAFF8D11D840E3001ECDEF /* examples */,
- 22CAFFA711D840E3001ECDEF /* fdpexpect.py */,
- 22CAFFA811D840E3001ECDEF /* FSM.py */,
- 22CAFFA911D840E3001ECDEF /* INSTALL */,
- 22CAFFAA11D840E3001ECDEF /* LICENSE */,
- 22CAFFAB11D840E3001ECDEF /* pexpect.py */,
- 22CAFFAD11D840E3001ECDEF /* PKG-INFO */,
- 22CAFFAE11D840E3001ECDEF /* pxssh.py */,
- 22CAFFAF11D840E3001ECDEF /* README */,
- 22CAFFB011D840E3001ECDEF /* screen.py */,
- 22CAFFB111D840E3001ECDEF /* setup.py */,
- );
- name = pexpect;
- path = link/pexpect;
- sourceTree = "<group>";
- };
- 22CAFF8111D840E3001ECDEF /* doc */ = {
- isa = PBXGroup;
- children = (
- 22CAFF8211D840E3001ECDEF /* ANSI.html */,
- 22CAFF8311D840E3001ECDEF /* clean.css */,
- 22CAFF8411D840E3001ECDEF /* email.png */,
- 22CAFF8511D840E3001ECDEF /* examples.html */,
- 22CAFF8611D840E3001ECDEF /* fdpexpect.html */,
- 22CAFF8711D840E3001ECDEF /* FSM.html */,
- 22CAFF8811D840E3001ECDEF /* index.html */,
- 22CAFF8911D840E3001ECDEF /* index.template.html */,
- 22CAFF8A11D840E3001ECDEF /* pexpect.html */,
- 22CAFF8B11D840E3001ECDEF /* pxssh.html */,
- 22CAFF8C11D840E3001ECDEF /* screen.html */,
- );
- path = doc;
- sourceTree = "<group>";
- };
- 22CAFF8D11D840E3001ECDEF /* examples */ = {
- isa = PBXGroup;
- children = (
- 22CAFF8E11D840E3001ECDEF /* astat.py */,
- 22CAFF8F11D840E3001ECDEF /* bd_client.py */,
- 22CAFF9011D840E3001ECDEF /* bd_serv.py */,
- 22CAFF9111D840E3001ECDEF /* cgishell.cgi */,
- 22CAFF9211D840E3001ECDEF /* chess.py */,
- 22CAFF9311D840E3001ECDEF /* chess2.py */,
- 22CAFF9411D840E3001ECDEF /* chess3.py */,
- 22CAFF9511D840E3001ECDEF /* df.py */,
- 22CAFF9611D840E3001ECDEF /* fix_cvs_files.py */,
- 22CAFF9711D840E3001ECDEF /* ftp.py */,
- 22CAFF9811D840E3001ECDEF /* hive.py */,
- 22CAFF9911D840E3001ECDEF /* log_69.80.212.10 */,
- 22CAFF9A11D840E3001ECDEF /* log_69.80.212.11 */,
- 22CAFF9B11D840E3001ECDEF /* monitor.py */,
- 22CAFF9C11D840E3001ECDEF /* passmass.py */,
- 22CAFF9D11D840E3001ECDEF /* python.py */,
- 22CAFF9E11D840E3001ECDEF /* README */,
- 22CAFF9F11D840E3001ECDEF /* rippy.py */,
- 22CAFFA011D840E3001ECDEF /* script.py */,
- 22CAFFA111D840E3001ECDEF /* ssh_session.py */,
- 22CAFFA211D840E3001ECDEF /* ssh_tunnel.py */,
- 22CAFFA311D840E3001ECDEF /* sshls.py */,
- 22CAFFA411D840E3001ECDEF /* table_test.html */,
- 22CAFFA511D840E3001ECDEF /* topip.py */,
- 22CAFFA611D840E3001ECDEF /* uptime.py */,
- );
- path = examples;
- sourceTree = "<group>";
- };
/* End PBXGroup section */
/* Begin PBXLegacyTarget section */