Merge branch 'matlab-agents' of ssh://git.ucc.asn.au/progcomp10 into matlab-agents matlab-agents
authorDaniel Axtens <[email protected]>
Fri, 3 Sep 2010 04:29:59 +0000 (12:29 +0800)
committerDaniel Axtens <[email protected]>
Fri, 3 Sep 2010 04:29:59 +0000 (12:29 +0800)
* 'matlab-agents' of ssh://git.ucc.asn.au/progcomp10:
  First attempt at a matlab link.

19 files changed:
doc/HOWTO.txt [new file with mode: 0644]
doc/INTERNALS.txt [new file with mode: 0644]
doc/JUDGING.txt [new file with mode: 0644]
doc/LICENSE [new file with mode: 0644]
doc/README.txt [new file with mode: 0644]
doc/UNSUPPORTED.txt [new file with mode: 0644]
doc/WELCOME.txt [new file with mode: 0644]
issues.txt
src/LICENSE [deleted file]
src/README
src/SampleAgents.py
src/arenas/CSampleAgents.py
src/arenas/PythonSampleAgents.py
src/link/C/README
src/link/C/agents/c_frenchie.c [deleted file]
src/link/C/c-link-lib.xcodeproj/project.pbxproj
src/link/C/c_agents.py
src/progcomp.xcodeproj/project.pbxproj
src/simulate.py

diff --git a/doc/HOWTO.txt b/doc/HOWTO.txt
new file mode 100644 (file)
index 0000000..b816965
--- /dev/null
@@ -0,0 +1,48 @@
+HOWTO.txt: A beginners guide to entering the UCC::ProgComp 2010.
+
+If you get stuck at any point, consult, in this order:
+ - documentation for the ProgComp
+ - Google
+
+=== Setting up a development environment ===
+
+The ProgComp will work best for those running Mac OS X or Linux, but Windows is also supported.
+
+All competitors will need Python, a modern, object-oriented scripting languages. Python comes pre-installed on Mac OS X and modern Linuxes - Windows users must download it from http://www.python.org/download/releases/2.7/
+
+Then software you'll then need depends on the language in which you wish to program. The most up-to-date details, including some useful links, can be found at http://progcomp.ucc.asn.au/FAQs under "What software do I need to enter?"
+
+Set up the relevant software now - we'll assume you have it working in the rest of this document.
+
+=== Trying out the sample agents ===
+
+Full sample code is supplied for all the supported languages.
+
+Pull up a terminal/command line prompt. Change directory to the src/ subfolder (*nix path conventions will be used throughout) and type "python simulate.py -v"
+
+You should see some output as "Angel", "Lucifer", "Streetfighter" and "Wash", the 4 sample agents, battle it out. If you an error is raised, well, that's a bit awkward. It's probably due to your python installation - check that, check the FAQs, then google the error message, then if none of that works, contact us.
+
+If you're using Python, take some time to poke around at SampleAgents.py, then skip to the next section.
+
+If you're using C/C++, Java or MATLAB, follow the instructions in the src/link/<language> directory to get those agents running. Again, if something goes wrong, check the documentation, the FAQ, Google, and then if still stumped, contact us.
+
+Take some time to poke around at the sample code and get a handle on what's going on and how it works.
+
+=== Making your own ===
+
+Here's where you have to do the thinking. Your agent must consist of a single source file, and provide the same function definitions as the sample agents. 
+
+<<standardise location for agents?>>
+Put your code in the "agents/"
+
+Information about creating the relevant python wrapper script to allow your program to interface with the supervisor should be provided with the sample code for your language.
+<<FIXME>>
+
+=== Submitting your own agent ===
+
+Procedures for submitting your own agent will be released by email and on the website soon. Stay tuned.
+
+Submitting your agent is not the end of the fun, either. All going well*, there should be a running leaderboard, so you can watch your agent compete, if you wish, or you can keep its runnings secret until the final judgement.
+
+* This includes the organiser not dying of a caffeine overdose or developing a psychiatric injury as a result of overloading and co-ordinating. Your mileage may vary. UCC members may donate to the coke account 'dja' if they wish to keep me supplied with coke and pizza during this time.
\ No newline at end of file
diff --git a/doc/INTERNALS.txt b/doc/INTERNALS.txt
new file mode 100644 (file)
index 0000000..2fe0a69
--- /dev/null
@@ -0,0 +1,47 @@
+INTERNALS.txt: Needless information about the internals
+
+This document is unreliable, out of date and more than likely, utterly useless. But it's included anyway.
+
+=== Notes originally found in src/README ===
+Contributor instructions:
+
+BaseAgent, LearningAgent and Supervisor are all implemented in uccProgComp.py.
+The 'select' algorithm, responsible for choosing agents for battle and
+determining when a round is finished, is the hottest part of the code and the
+most open to discussion and change. 
+
+Unfortunately, it is not an easy bit of code to understand. Once upon a time,
+in builds long past, it used friendly O(n) operations and conveniently wasted
+memory on simple tasks. After hours of profiling, it is a little more complex,
+but with a bit of background to how the supervisor operates you shouldn't have
+much trouble working out the rest:
+
+1.) A copy of the current population list is made at the beginning of the round
+representing the agents who can still fight. This reduces finding valid agents
+from O(n) to O(1). I call it the 'remaining' list.
+2.) Agents must remember their index in the population list. This is because it
+would be O(n) to determine their index in the population list (to remove them
+when they die) from their index in the 'remaining' list. Agents have this value
+stored at the beginning of the round - O(n) at the beginning of the round is
+far preferable to O(n) for every death.
+3.) The actual removal of agents from the population list must happen all at
+once in reverse numeric index order at the end of the round so that the stored
+index that agents have does not become stale. 
+
+There are problems. It's not perfect, but it's relatively fast and powerful and
+quite easy to adjust or reimplement once you get your head around it. I'm very
+much open to suggestion for improvement (especially in the form of patches) and
+welcome all help, constructive criticism, derisive criticism and death threats.
+
+Things to be done:
+
+1.) Pretty graphs! Iterate () returns a collection of statistics about each of
+the classes, which can be seen used in simulate.py. There are plenty of
+plotting packages out there that can turn this information into impressive
+charts.
+2.) More built-in functionality for BaseAgent and LearningAgent. They could
+both do with a few more utility functions for competitors to use.
+3.) A more succint set of rules and documentation.
+
+Thanks for reading!
+Luke
diff --git a/doc/JUDGING.txt b/doc/JUDGING.txt
new file mode 100644 (file)
index 0000000..87ecdd6
--- /dev/null
@@ -0,0 +1,22 @@
+JUDGING.txt: An insight into the capricious and arbitrary mind of the organiser on how your agent will be judged.
+
+<<FIXME: check this is accurate and OK to publish>>
+
+IN SUMMARY: write clean, efficient, portable, smart code that just does what it's told and doesn't try to do anything it shouldn't. Don't rely on *anything* not expressed in sample code, or preferably, documentation. If in doubt, ask. 
+
+THINGS NOT TO DO:
+ - Inline assembler.
+ - Deliberately obfuscated code.
+ - Attempts to communicate between bots.
+ - File, network or system access.
+
+Other points:
+
+There are lots of divisions. Each division has its own prizes. How many divisions there are, and what the prizes are, depends on how much we get sponsored, and how creative I am at the time.
+
+Be honest in the divisions you sign up for, and don't play silly games. Trying to break the software, security, machines, my mind, etc., are all frowned upon and may result in instant disqualification, etc., as laid out in the rules.
+
+To win the most prizes:
+ - Allow your agent to be run on the scoreboard: I might give a prize to top-of-the-ladder agents.
+ - Make your agent as fast and efficient as possible - there might be *lots* of instances.
+ - Don't rely on points tables too much. I am interested in how agents perform in different situations - like a zero sum arena for example. If I ever get around to looking at this I will make it possible for your agent to query the points table.
diff --git a/doc/LICENSE b/doc/LICENSE
new file mode 100644 (file)
index 0000000..e25c106
--- /dev/null
@@ -0,0 +1,19 @@
+Copyright (c) 2008 Luke Williams
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/doc/README.txt b/doc/README.txt
new file mode 100644 (file)
index 0000000..2616460
--- /dev/null
@@ -0,0 +1,14 @@
+=== UCC::ProgComp 2010 ===
+
+Congratulations, you've found the documentation!
+
+ - WELCOME.txt: A general introduction to the competition.
+ - HOWTO.txt: A guide to getting the software you need to compete, and making your first baby steps towards competing.
+ - JUDGING.txt: An insight into the capricious and arbitrary mind of the organiser on how your agent will be judged.
+ - http://progcomp.ucc.asn.au/Rules : the rules of the competition
+ - http://progcomp.ucc.asn.au/FAQs : Frequently Asked Questions
+ - http://progcomp.ucc.asn.au/More%20Info : General Info
+ - NOTES.txt: possibly important stuff that doesn't fit anywhere else.
+ - INTERNALS.txt: Internal information which might interest you but which you shouldn't rely upon.
+ - UNSUPPORTED.txt: How to use a language that isn't Python, C/C++, Java or Octave/Matlab.
+ - LICENSE: the terms under which the code is released to you.
\ No newline at end of file
diff --git a/doc/UNSUPPORTED.txt b/doc/UNSUPPORTED.txt
new file mode 100644 (file)
index 0000000..02317e8
--- /dev/null
@@ -0,0 +1,4 @@
+UNSUPPORTED.txt: You should not need this file.
+
+Consult the website.
+FIXME: more info?
\ No newline at end of file
diff --git a/doc/WELCOME.txt b/doc/WELCOME.txt
new file mode 100644 (file)
index 0000000..d2fe830
--- /dev/null
@@ -0,0 +1,30 @@
+Welcome to UCC::ProgComp 2010!
+
+This document will acquaint you with the competition: the rules, how to write an agent, and what you need to do to enter.
+
+=== What is UCC::ProgComp? ===
+Good question! The facetious answer is that it's the package whose documentation you are currently reading. The long answer is that it's a project of the University Computer Club (UCC), a student club affiliated with the Guild of Undergraduates at the University of Western Australia. UCC::ProgComp is designed to raise interest in programming and raise awareness of what UCC offers.
+
+=== Why should I enter? ===
+For a number of reasons:
+ - there are prizes.
+ - it's a low-risk opportunity to learn how to program or to practise your programming. You don't need to be an expert to enter, and it's a great way to do things that you might not otherwise get the opportunity to do.
+ - To meet other computer-oriented people around UCC.
+
+=== What's the basic premise? ===
+Entry in UCC::ProgComp is by writing an agent that plays a modified version of Rock-Paper-Scissors on the morally bankrupt underworld of RPS Island.
+
+On RPS Island, this classic game is considerably more complex: the attacking agent must bluff to the defending agent before making its real attack. Agents receive a moderate rewarded for being nice to each other and going for a mutually beneficial tie, but receive the most points for stabbing the other in the back.
+
+An agent consists of a Python, C/C++, Java or MATLAB file with 3 functions:
+
+ * A function to attack another bot.
+ * A function to defend itself against another bot.
+ * An optional function to receive the results of its battle, so that it can learn how other agents play.
+
+=== OK, how? ===
+Keep reading! Read HOWTO.txt, then go to README.txt to see what other documents are available.
+
+=== I've read everything and I'm still confused! ===
+Firstly, check the FAQs at http://progcomp.ucc.asn.au
+If you're still stumped, contact us via the link at http://progcomp.ucc.asn.au
\ No newline at end of file
index d6a2c4e..80daf7c 100644 (file)
@@ -1,4 +1,4 @@
- - number of agents can spiral out of control very quickly, e.g. if Frenchie and Angel start duking it out. 
+ - number of agents can spiral out of control very quickly, e.g. if Wash and Angel start duking it out.
    * Need to make supervisor smart enough to kill montonically increasing sequences.
  - points table doesn't agree with technicalities doc
  - agents die after MAX_AGE fights, not MAX_AGE rounds
diff --git a/src/LICENSE b/src/LICENSE
deleted file mode 100644 (file)
index e25c106..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-Copyright (c) 2008 Luke Williams
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
index d04bf5d..f1cddde 100644 (file)
@@ -1,3 +1,5 @@
+<<PLEASE SEE THE CONTENTS OF doc/ FIRST>>
+
 Hi there,
 
 Thanks for taking interest in the UCC Programming Competition 2010. If you 
@@ -20,47 +22,5 @@ edit the first few lines of simulate.py to include your agent.
 ...and if all you're interested in is participating, that's it! You can stop
 reading, and start work on the agent that will outsmart them all!
 
-Contributor instructions:
-
-BaseAgent, LearningAgent and Supervisor are all implemented in uccProgComp.py.
-The 'select' algorithm, responsible for choosing agents for battle and
-determining when a round is finished, is the hottest part of the code and the
-most open to discussion and change. 
-
-Unfortunately, it is not an easy bit of code to understand. Once upon a time,
-in builds long past, it used friendly O(n) operations and conveniently wasted
-memory on simple tasks. After hours of profiling, it is a little more complex,
-but with a bit of background to how the supervisor operates you shouldn't have
-much trouble working out the rest:
-
-1.) A copy of the current population list is made at the beginning of the round
-representing the agents who can still fight. This reduces finding valid agents
-from O(n) to O(1). I call it the 'remaining' list.
-2.) Agents must remember their index in the population list. This is because it
-would be O(n) to determine their index in the population list (to remove them
-when they die) from their index in the 'remaining' list. Agents have this value
-stored at the beginning of the round - O(n) at the beginning of the round is
-far preferable to O(n) for every death.
-3.) The actual removal of agents from the population list must happen all at
-once in reverse numeric index order at the end of the round so that the stored
-index that agents have does not become stale. 
-
-There are problems. It's not perfect, but it's relatively fast and powerful and
-quite easy to adjust or reimplement once you get your head around it. I'm very
-much open to suggestion for improvement (especially in the form of patches) and
-welcome all help, constructive criticism, derisive criticism and death threats.
-
-Things to be done:
-
-1.) Pretty graphs! Iterate () returns a collection of statistics about each of
-the classes, which can be seen used in simulate.py. There are plenty of
-plotting packages out there that can turn this information into impressive
-charts.
-2.) More built-in functionality for BaseAgent and LearningAgent. They could
-both do with a few more utility functions for competitors to use.
-3.) A more succint set of rules and documentation.
-
-Thanks for reading!
-Luke
 
 * Or rather, it wil by the time this package is ready for distribution.
index 6da30ba..8a3c439 100644 (file)
@@ -56,8 +56,9 @@ class Streetfighter (BaseAgent):
 
 # This is our first bot with any sort of learning capability, based on the LearningAgent base.
 # Experienced programmers might opt to write their own learning code based on BaseAgent, but it's up to you.
-# Frenchie is a simple bot that is by default nice but will permanently turn against any agent that betrays it.
-class Frenchie (LearningAgent):
+# Wash is a simple bot that is by default nice but will permanently turn against any agent that betrays it.
+# "Curse your suddent but inevitable betrayal" - Wash (Firefly)
+class Wash (LearningAgent):
        def Attack (self, foe):
                attack = RandomAttack ()
                if Loss in LearningAgent.GetWinHistory (self, foe):
index a49d6df..3ec8edb 100644 (file)
@@ -5,7 +5,7 @@ Written by Daniel Axtens <[email protected]> for the UCC Programming Competition in
 Licensed under an MIT-style license: see the LICENSE file for details.
 '''
 
-from link.C.c_agents import c_angel, c_lucifer, c_streetfighter, c_frenchie
+from link.C.c_agents import c_angel, c_lucifer, c_streetfighter, c_wash
 
 class arena:
-       Agents =  [c_angel,c_lucifer,c_streetfighter,c_frenchie]
+       Agents =  [c_angel,c_lucifer,c_streetfighter,c_wash]
index 0a710c4..cdaab5f 100755 (executable)
@@ -6,9 +6,9 @@ Written by Daniel Axtens <[email protected]> for the UCC Programming Competition in
 Licensed under an MIT-style license: see the LICENSE file for details.
 '''
 
-from SampleAgents import Angel, Lucifer, Dummy, Frenchie, Streetfighter
+from SampleAgents import Angel, Lucifer, Dummy, Wash, Streetfighter
 
 
 # Import and add your agents here:
 class arena:
-    Agents =  [Angel,Lucifer,Streetfighter,Frenchie]
\ No newline at end of file
+    Agents =  [Angel,Lucifer,Streetfighter,Wash]
index 9afcc16..ad894a7 100644 (file)
@@ -18,12 +18,12 @@ Your agents live in link.C.c_agents
 Add them to Agents to get them to do battle.
 
 For example, this code imports c_angel, c_lucifer, c_streetfighter and
-c_frenchie, as well as the python sample agents, and then battles c_lucifer, 
-python Frenchie, c_streetfighter and c_angel. It goes at the top of simulate.py.
+c_wash, as well as the python sample agents, and then battles c_lucifer, 
+python Wash, c_streetfighter and c_angel. It goes at the top of simulate.py.
 
 # Import and add your agents here:
-from link.C.c_agents import c_angel, c_lucifer, c_streetfighter, c_frenchie
+from link.C.c_agents import c_angel, c_lucifer, c_streetfighter, c_wash
 
-from SampleAgents import Angel, Lucifer, Dummy, Frenchie, Streetfighter
-Agents = [c_lucifer, Frenchie, c_streetfighter, c_angel]
+from SampleAgents import Angel, Lucifer, Dummy, Wash, Streetfighter
+Agents = [c_lucifer, Wash, c_streetfighter, c_angel]
 
diff --git a/src/link/C/agents/c_frenchie.c b/src/link/C/agents/c_frenchie.c
deleted file mode 100644 (file)
index c45085e..0000000
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- *  c_frechie.c
- *  c-link-lib
- *
- *  Created by Daniel Axtens on 22/04/10.
- *  Licensed under an MIT-style license: see the LICENSE file for details.
- *
- */
-
-#include <c_link.h>
-#include <stdlib.h>
-#include <string.h>
-
-/* Implement the frenchie bot, that is by default nice but will 
-   permanently turn against any agent that betrays it.
-   This is trickier in C than in any other language, for a number of reasons:
-     - there's no classes in C, so we can't just write a generic learning agent
-       and subclass it.
-     - your agent has no idea how many agents it's going to battle, or how many
-       battles it is going to fight, so you've got to do dynamic memory allocation.
-        (anyone who tries to read the source of the supervisor to find out is liable
-         to have their program break unexpectedly)
- */
-
-/* To simplify things, we just look at whether we have lost to a particular agent.
-   Unlike in the Python version, we don't keep a generic list
-   This is also done in a inefficient (O(bot-cout)) way.
-   Implementing a faster version is left as an exercise to the DSA student. */
-
-/* Our guess at the number of agents I'm going to fight in my lifetime
-   (note that this is only a guess, not an upper limit. Do *not* take it as 
-   gospel on the number of agents you're going to see. */
-#define NUMBEROFAGENTSGUESS 100
-
-/* The name of the n-th foe who has beaten us */
-char (*defeatingFoes)[MAXFOENAMELEN] = NULL;
-
-/* The length of the array, and how far we are along it */
-size_t foesLen = 0;
-unsigned int foesCount = 0;
-
-/* an internal function - have I lost to a given foe? */
-int haveLostTo( char * foeName ) {
-    int foe;
-    
-    /* check every foe we know to have defeated us */
-    for (foe=0; foe<foesCount; foe++) {
-        if (strncmp( defeatingFoes[foe], foeName, MAXFOENAMELEN) == 0) {
-            //debugmsg( "%d\thaveLostTo( %s ) -> Yes\n", me, foeName );
-            return 1;
-        }
-    }
-    
-    /* this foe not found */
-    return 0;
-}
-
-
-ATTACKTYPE Attack( char * foeName ) {
-       ATTACKTYPE attack;
-    
-       attack.realAttack =  RandomAttack();
-       
-    /* have I lost to this foe? */
-    if ( haveLostTo(foeName) ) {
-        /* Assume they are lying (FIXME: I'm not entirely sure why the python
-           does what it does: I'm just duplicating.) */
-        switch (attack.realAttack) {
-            case rock:
-                attack.promisedAttack = scissors;
-                break;
-            case paper:
-                attack.promisedAttack = rock;
-                break;
-            default: /* attack = scissors */
-                attack.promisedAttack = paper;
-                break;
-        }
-    } else {
-        /* be nice! */
-        attack.promisedAttack = attack.realAttack;
-    }
-
-       
-       return attack;
-}
-
-
-ITEMTYPE Defend( char * foeName, ITEMTYPE foePromisedAttack ) {
-       ITEMTYPE defence;
-       
-    if (haveLostTo(foeName)) {
-        /* They've screwed us in the past, assume they're lying and go for the
-           kill. */
-        switch (foePromisedAttack) {
-            case rock:
-                defence = scissors;
-                break;
-            case paper:
-                defence = rock;
-                break;
-            default:
-                defence = paper;
-                break;
-        }
-    } else {
-        /* be nice! */
-        defence = foePromisedAttack;
-    }
-
-    return defence;
-}
-
-/* This is so much less fun in C */
-void Results( char * foeName, int isInstigatedByYou, RESULTTYPE winner,
-             ITEMTYPE attItem, ITEMTYPE defItem, ITEMTYPE bluffItem,
-             int pointDelta ) {
-       
-    int foe;
-    
-    /* check to see if we've initialised our arrays */
-       if (defeatingFoes == NULL) {
-        defeatingFoes = calloc( NUMBEROFAGENTSGUESS, sizeof( MAXFOENAMELEN*sizeof(char) ) );
-        foesLen = NUMBEROFAGENTSGUESS;
-    }
-    
-    /* figure out if we lost, which is the only thing we care about
-       if we didn't, move on. */
-    if ((winner == tie) || 
-        (winner==attacker && isInstigatedByYou) ||
-        (winner==defender && !isInstigatedByYou) ) return;
-    
-    //fprintf( stderr, "%d\tsaving loss from %s\n", me, foeName );
-    
-    /* if we've already lost the foe, don't store again */
-    for (foe=0; foe<foesCount; foe++) {
-        if (strncmp( defeatingFoes[foe], foeName, MAXFOENAMELEN ) == 0) {
-            /* we've found it! */
-            return;
-        }
-    }
-    
-    /* we haven't found the foe. add it, expanding the array if needed */
-    if (foesCount==foesLen) {
-        /* double the array size */
-        defeatingFoes = realloc( defeatingFoes, foesLen*2*sizeof( MAXFOENAMELEN*sizeof(char) ) );
-        foesLen *= 2;
-    }
-    
-    strncpy( defeatingFoes[foesCount], foeName, MAXFOENAMELEN );
-    foesCount++;
-    
-    return;
-}
-
-/* Cleanup() */
-
-void Cleanup() {
-       free(defeatingFoes);
-}
\ No newline at end of file
index e5afa2b..e4f83ef 100644 (file)
@@ -7,7 +7,7 @@
        objects = {
 
 /* Begin PBXFileReference section */
-               2208AFE6118F28D800770C92 /* c_frenchie.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = c_frenchie.c; sourceTree = "<group>"; };
+               2208AFE6118F28D800770C92 /* c_wash.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = c_wash.c; sourceTree = "<group>"; };
                2208AFE7118F28F400770C92 /* c_agents.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = c_agents.py; sourceTree = "<group>"; };
                2291A1BB117EDB9600854CBE /* c_link.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = c_link.c; sourceTree = "<group>"; };
                2291A1BD117EE3FD00854CBE /* c_angel.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = c_angel.c; sourceTree = "<group>"; };
@@ -38,7 +38,7 @@
                                2291A1BD117EE3FD00854CBE /* c_angel.c */,
                                2291A1BE117EE3FD00854CBE /* c_lucifer.c */,
                                2291A1BF117EE3FD00854CBE /* c_streetfighter.c */,
-                               2208AFE6118F28D800770C92 /* c_frenchie.c */,
+                               2208AFE6118F28D800770C92 /* c_wash.c */,
                        );
                        path = agents;
                        sourceTree = "<group>";
index dfc1393..aabdc23 100644 (file)
@@ -15,6 +15,6 @@ class c_streetfighter (cAgent):
        def __init__ (self):
                cAgent.__init__(self, "./link/C/agents/c_streetfighter")
 
-class c_frenchie (cAgent):
+class c_wash (cAgent):
        def __init__ (self):
-               cAgent.__init__(self, "./link/C/agents/c_frenchie")
+               cAgent.__init__(self, "./link/C/agents/c_wash")
index ca03935..7d4f271 100644 (file)
@@ -20,6 +20,7 @@
                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>"; };
+               22DB7DF31223BAF700E04CAB /* conf.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = conf.py; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 
 /* Begin PBXGroup section */
@@ -31,6 +32,7 @@
                                22CAFEEB11D84076001ECDEF /* README */,
                                22CAFEEC11D84076001ECDEF /* rpsconst.py */,
                                22CAFEED11D84076001ECDEF /* SampleAgents.py */,
+                               22DB7DF31223BAF700E04CAB /* conf.py */,
                                22CAFEEE11D84076001ECDEF /* selectAlgorithms.py */,
                                22CAFEEF11D84076001ECDEF /* simulate.py */,
                                22CAFEF011D84076001ECDEF /* uccProgComp.py */,
index cdf6d86..438a49e 100755 (executable)
@@ -21,7 +21,7 @@ usage = "Usage: rps [-v] [-i iterations=150] [-n starting_populations=10] [-t tr
 for i in range (1,len(sys.argv)):
        if sys.argv[i] == "-i":
                try:
-                       maxIterations = int(sys.argv[i+1])
+                       MAX_ITERATIONS = int(sys.argv[i+1])
                        i += 1
                        continue
                except:
@@ -37,7 +37,7 @@ for i in range (1,len(sys.argv)):
                        sys.exit(1)
        elif sys.argv[i] == "-t":
                try:
-                       trials = int(sys.argv[i+1])
+                       TRIALS = int(sys.argv[i+1])
                        i += 1
                        continue
                except:
@@ -81,7 +81,7 @@ while trial < TRIALS:
        else: winners[winner[0]] = 1
        #print "Winner: %s" % winner[0]
 
-print "SCOREBOARD OVER %d TRIALS OF %d ROUNDS EACH" % (trials, maxIterations)
+print "SCOREBOARD OVER %d TRIALS OF %d ROUNDS EACH" % (TRIALS, MAX_ITERATIONS)
 rawscoreboard = sorted ( [(score,player) for (player,score) in winners.items ()] , reverse=True )
 scoreboard = []
 for score, player in rawscoreboard:

UCC git Repository :: git.ucc.asn.au