initial import, after some monkeying around
authorDaniel Axtens <[email protected]>
Tue, 20 Apr 2010 15:55:07 +0000 (23:55 +0800)
committerDaniel Axtens <[email protected]>
Tue, 20 Apr 2010 15:55:07 +0000 (23:55 +0800)
47 files changed:
.gitattributes [new file with mode: 0644]
.gitignore [new file with mode: 0644]
issues [new file with mode: 0644]
link/C/Link/c-link-lib/Makefile [new file with mode: 0644]
link/C/Link/c-link-lib/build/c-link-lib.build/Debug/c-link-lib.build/build-state.dat [new file with mode: 0644]
link/C/Link/c-link-lib/build/c-link-lib.build/Debug/c-link-lib.build/build-state~.dat [new file with mode: 0644]
link/C/Link/c-link-lib/build/c-link-lib.build/Debug/c-link-lib.build/c-link-lib.dep [new file with mode: 0644]
link/C/Link/c-link-lib/build/c-link-lib.build/Debug/c-link-lib.build/c-link-lib~.dep [new file with mode: 0644]
link/C/Link/c-link-lib/build/c-link-lib.build/c-link-lib.pbxindex/categories.pbxbtree [new file with mode: 0644]
link/C/Link/c-link-lib/build/c-link-lib.build/c-link-lib.pbxindex/cdecls.pbxbtree [new file with mode: 0644]
link/C/Link/c-link-lib/build/c-link-lib.build/c-link-lib.pbxindex/decls.pbxbtree [new file with mode: 0644]
link/C/Link/c-link-lib/build/c-link-lib.build/c-link-lib.pbxindex/files.pbxbtree [new file with mode: 0644]
link/C/Link/c-link-lib/build/c-link-lib.build/c-link-lib.pbxindex/imports.pbxbtree [new file with mode: 0644]
link/C/Link/c-link-lib/build/c-link-lib.build/c-link-lib.pbxindex/pbxindex.header [new file with mode: 0644]
link/C/Link/c-link-lib/build/c-link-lib.build/c-link-lib.pbxindex/protocols.pbxbtree [new file with mode: 0644]
link/C/Link/c-link-lib/build/c-link-lib.build/c-link-lib.pbxindex/refs.pbxbtree [new file with mode: 0644]
link/C/Link/c-link-lib/build/c-link-lib.build/c-link-lib.pbxindex/strings.pbxstrings/control [new file with mode: 0644]
link/C/Link/c-link-lib/build/c-link-lib.build/c-link-lib.pbxindex/strings.pbxstrings/strings [new file with mode: 0644]
link/C/Link/c-link-lib/build/c-link-lib.build/c-link-lib.pbxindex/subclasses.pbxbtree [new file with mode: 0644]
link/C/Link/c-link-lib/build/c-link-lib.build/c-link-lib.pbxindex/symbols0.pbxsymbols [new file with mode: 0644]
link/C/Link/c-link-lib/c-link-lib.xcodeproj/project.pbxproj [new file with mode: 0644]
link/C/Link/c-link-lib/c-link.c [new file with mode: 0644]
link/C/Link/c-link-lib/c-link.h [new file with mode: 0644]
link/C/Link/c-link-lib/c-link.o [new file with mode: 0644]
link/C/Link/c-link-lib/link.o [new file with mode: 0644]
link/C/Link/c-link-lib/rps-c [new file with mode: 0755]
link/C/Link/c-link-lib/sample-agents/c-angel.c [new file with mode: 0644]
link/C/Link/c-link-lib/sample-agents/c-lucifer.c [new file with mode: 0644]
link/C/Link/c-link-lib/sample-agents/c-streetfighter.c [new file with mode: 0644]
link/Mathematica/pyml.tar.gz [new file with mode: 0644]
link/Mathematica/pythonika-1.0.tar.gz [new file with mode: 0644]
proposal.txt [new file with mode: 0644]
rps/trunk/LICENSE [new file with mode: 0644]
rps/trunk/README [new file with mode: 0644]
rps/trunk/SampleAgents.py [new file with mode: 0644]
rps/trunk/SampleAgents.py.old [new file with mode: 0644]
rps/trunk/SampleAgents.pyc [new file with mode: 0644]
rps/trunk/djaAgents.py [new file with mode: 0644]
rps/trunk/djaAgents.pyc [new file with mode: 0644]
rps/trunk/rpsconst.py [new file with mode: 0644]
rps/trunk/rpsconst.pyc [new file with mode: 0644]
rps/trunk/selectAlgorithms.py [new file with mode: 0644]
rps/trunk/simulate.py [new file with mode: 0755]
rps/trunk/uccProgComp.py [new file with mode: 0644]
rps/trunk/uccProgComp.py.old [new file with mode: 0644]
rps/trunk/uccProgComp.pyc [new file with mode: 0644]
technicalities.txt [new file with mode: 0644]

diff --git a/.gitattributes b/.gitattributes
new file mode 100644 (file)
index 0000000..313081b
--- /dev/null
@@ -0,0 +1,2 @@
+*.pbxproj -crlf -diff -merge
+
diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..d676377
--- /dev/null
@@ -0,0 +1,11 @@
+# xcode noise
+build/*
+*.pbxuser
+*.mode1v3
+
+# old skool
+.svn
+
+# osx noise
+.DS_Store
+profile
diff --git a/issues b/issues
new file mode 100644 (file)
index 0000000..393bd1a
--- /dev/null
+++ b/issues
@@ -0,0 +1,6 @@
+ - number of agents can spiral out of control very quickly, e.g. if Frenchie and Angel start duking it out. 
+ - points table doesn't agree with technicalities doc
+ - agents die after MAX_AGE fights, not MAX_AGE rounds
+ - code seems to trust y ou not to mnokey around with your stats...?
+ - no way to tell an external agent that their services are no longer required.
+  * amend to provide a BYE command
diff --git a/link/C/Link/c-link-lib/Makefile b/link/C/Link/c-link-lib/Makefile
new file mode 100644 (file)
index 0000000..86d085d
--- /dev/null
@@ -0,0 +1,14 @@
+CC=gcc
+CFLAGS=-c -Wall
+LDFLAGS=
+SOURCES=c-link.c
+OBJECTS=$(SOURCES:.c=.o)
+EXECUTABLE=rps-c
+
+all: $(SOURCES) $(EXECUTABLE)
+       
+$(EXECUTABLE): $(OBJECTS) 
+       $(CC) $(LDFLAGS) $(OBJECTS) -o $@
+
+.c.o:
+       $(CC) $(CFLAGS) $< -o $@
diff --git a/link/C/Link/c-link-lib/build/c-link-lib.build/Debug/c-link-lib.build/build-state.dat b/link/C/Link/c-link-lib/build/c-link-lib.build/Debug/c-link-lib.build/build-state.dat
new file mode 100644 (file)
index 0000000..4232c1f
--- /dev/null
@@ -0,0 +1,26 @@
+Tc-link-lib
+v7
+r0
+t293430347.727391
+cCheck dependencies
+cExternalBuildToolExecution c-link-lib
+
+N/usr/bin/make
+c000000004A11964700000000000556C0
+t1242666567
+s349888
+
+CCheck dependencies
+r0
+lSLF07#2@18"Check dependencies293430346#293430346#0(0"0(0#1#0"4300885448#0"0#
+
+CExternalBuildToolExecution c-link-lib
+s293430346.724316
+e293430347.727343
+r1
+xExternalBuildToolExecution
+xc-link-lib
+ogcc -c -Wall c-link.c -o c-link.o
+ogcc  c-link.o -o rps-c
+lSLF07#2@23"Run external build tool293430346#293430347#0(57"gcc -c -Wall c-link.c -o c-link.o\rgcc  c-link.o -o rps-c\r2(13@34"gcc -c -Wall c-link.c -o c-link.o\r293430346#0#34#0(1@0"0(13@23"gcc  c-link.o -o rps-c\r293430347#34#23#0(1@0"0(0#0#0"4300885448#9988"    cd /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib\r    setenv ACTION \r    setenv ALTERNATE_GROUP staff\r    setenv ALTERNATE_MODE u+w,go-w,a+rX\r    setenv ALTERNATE_OWNER dja\r    setenv ALWAYS_SEARCH_USER_PATHS YES\r    setenv APPLE_INTERNAL_DEVELOPER_DIR /AppleInternal/Developer\r    setenv APPLE_INTERNAL_DIR /AppleInternal\r    setenv APPLE_INTERNAL_DOCUMENTATION_DIR /AppleInternal/Documentation\r    setenv APPLE_INTERNAL_LIBRARY_DIR /AppleInternal/Library\r    setenv APPLE_INTERNAL_TOOLS /AppleInternal/Developer/Tools\r    setenv APPLY_RULES_IN_COPY_FILES NO\r    setenv ARCHS i386\r    setenv BUILD_COMPONENTS "headers build"\r    setenv BUILD_DIR /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib/build\r    setenv BUILD_ROOT /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib/build\r    setenv BUILD_STYLE Debug\r    setenv BUILD_VARIANTS normal\r    setenv BUILT_PRODUCTS_DIR /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib/build/Debug\r    setenv CACHE_ROOT /var/folders/Kh/KhsdbCr-FSeYmRs916MI4k+++TI/-Caches-/com.apple.Xcode.501\r    setenv CLASS_FILE_DIR /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib/build/c-link-lib.build/Debug/c-link-lib.build/JavaClasses\r    setenv CLONE_HEADERS NO\r    setenv CONFIGURATION Debug\r    setenv CONFIGURATION_BUILD_DIR /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib/build/Debug\r    setenv CONFIGURATION_TEMP_DIR /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib/build/c-link-lib.build/Debug\r    setenv COPYING_PRESERVES_HFS_DATA NO\r    setenv COPY_PHASE_STRIP NO\r    setenv DEAD_CODE_STRIPPING NO\r    setenv DEBUGGING_SYMBOLS YES\r    setenv DEPLOYMENT_LOCATION NO\r    setenv DEPLOYMENT_POSTPROCESSING NO\r    setenv DERIVED_FILES_DIR \r    setenv DERIVED_FILE_DIR /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib/build/c-link-lib.build/Debug/c-link-lib.build/DerivedSources\r    setenv DERIVED_SOURCES_DIR /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib/build/c-link-lib.build/Debug/c-link-lib.build/DerivedSources\r    setenv DEVELOPER_APPLICATIONS_DIR /Developer/Applications\r    setenv DEVELOPER_BIN_DIR /Developer/usr/bin\r    setenv DEVELOPER_DIR /Developer\r    setenv DEVELOPER_FRAMEWORKS_DIR /Developer/Library/Frameworks\r    setenv DEVELOPER_FRAMEWORKS_DIR_QUOTED "\"/Developer/Library/Frameworks\""\r    setenv DEVELOPER_LIBRARY_DIR /Developer/Library\r    setenv DEVELOPER_SDK_DIR /Developer/SDKs\r    setenv DEVELOPER_TOOLS_DIR /Developer/Tools\r    setenv DEVELOPER_USR_DIR /Developer/usr\r    setenv DEVELOPMENT_LANGUAGE English\r    setenv DO_HEADER_SCANNING_IN_JAM NO\r    setenv DSTROOT /tmp/c-link-lib.dst\r    setenv DWARF_DSYM_FILE_NAME .dSYM\r    setenv DWARF_DSYM_FOLDER_PATH /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib/build/Debug\r    setenv ENABLE_HEADER_DEPENDENCIES YES\r    setenv ENABLE_OPENMP_SUPPORT NO\r    setenv EXCLUDED_INSTALLSRC_SUBDIRECTORY_PATTERNS ".svn CVS"\r    setenv EXCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES "*.nib *.lproj *.framework *.gch *.xcode* (*) CVS .svn"\r    setenv FILE_LIST /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib/build/c-link-lib.build/Debug/c-link-lib.build/Objects/LinkFileList\r    setenv FRAMEWORK_VERSION A\r    setenv GCC3_VERSION 3.3\r    setenv GCC_DYNAMIC_NO_PIC NO\r    setenv GCC_ENABLE_FIX_AND_CONTINUE YES\r    setenv GCC_GENERATE_DEBUGGING_SYMBOLS YES\r    setenv GCC_OPTIMIZATION_LEVEL 0\r    setenv GCC_WARN_ABOUT_RETURN_TYPE YES\r    setenv GCC_WARN_UNUSED_VARIABLE YES\r    setenv GENERATE_MASTER_OBJECT_FILE NO\r    setenv GENERATE_PKGINFO_FILE NO\r    setenv GID 20\r    setenv GROUP staff\r    setenv HEADERMAP_INCLUDES_FLAT_ENTRIES_FOR_TARGET_BEING_BUILT YES\r    setenv HEADERMAP_INCLUDES_FRAMEWORK_ENTRIES_FOR_ALL_PRODUCT_TYPES YES\r    setenv HEADERMAP_INCLUDES_NONPUBLIC_NONPRIVATE_HEADERS YES\r    setenv HEADERMAP_INCLUDES_PROJECT_HEADERS YES\r    setenv INFOPLIST_EXPAND_BUILD_SETTINGS YES\r    setenv INFOPLIST_OUTPUT_FORMAT same-as-input\r    setenv INFOPLIST_PREPROCESS NO\r    setenv INSTALL_DIR /tmp/c-link-lib.dst\r    setenv INSTALL_GROUP staff\r    setenv INSTALL_MODE_FLAG u+w,go-w,a+rX\r    setenv INSTALL_OWNER dja\r    setenv INSTALL_ROOT /tmp/c-link-lib.dst\r    setenv JAVA_APP_STUB /System/Library/Frameworks/JavaVM.framework/Resources/MacOS/JavaApplicationStub\r    setenv JAVA_ARCHIVE_CLASSES YES\r    setenv JAVA_ARCHIVE_TYPE JAR\r    setenv JAVA_COMPILER /usr/bin/javac\r    setenv JAVA_FRAMEWORK_RESOURCES_DIRS Resources\r    setenv JAVA_JAR_FLAGS cv\r    setenv JAVA_SOURCE_SUBDIR .\r    setenv JAVA_USE_DEPENDENCIES YES\r    setenv JAVA_ZIP_FLAGS -urg\r    setenv KEEP_PRIVATE_EXTERNS NO\r    setenv LD_GENERATE_MAP_FILE NO\r    setenv LD_MAP_FILE_PATH /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib/build/c-link-lib.build/Debug/c-link-lib.build/c-link-lib-LinkMap--.txt\r    setenv LD_OPENMP_FLAGS -fopenmp\r    setenv LINKER_DISPLAYS_MANGLED_NAMES NO\r    setenv LINK_WITH_STANDARD_LIBRARIES YES\r    setenv LOCAL_ADMIN_APPS_DIR /Applications/Utilities\r    setenv LOCAL_APPS_DIR /Applications\r    setenv LOCAL_DEVELOPER_DIR /Library/Developer\r    setenv LOCAL_LIBRARY_DIR /Library\r    setenv MACOSX_DEPLOYMENT_TARGET 10.6\r    setenv MAC_OS_X_VERSION_ACTUAL 1063\r    setenv MAC_OS_X_VERSION_MAJOR 1060\r    setenv MAC_OS_X_VERSION_MINOR 0603\r    setenv OBJECT_FILE_DIR /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib/build/c-link-lib.build/Debug/c-link-lib.build/Objects\r    setenv OBJROOT /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib/build\r    setenv ONLY_ACTIVE_ARCH YES\r    setenv OPTIMIZATION_LEVEL 0\r    setenv OS MACOS\r    setenv PATH_PREFIXES_EXCLUDED_FROM_HEADER_DEPENDENCIES "/usr/include /usr/local/include /System/Library/Frameworks /System/Library/PrivateFrameworks /Developer/Headers /Developer/SDKs /Developer/Platforms"\r    setenv PLIST_FILE_OUTPUT_FORMAT same-as-input\r    setenv PREBINDING NO\r    setenv PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR YES\r    setenv PRECOMP_DESTINATION_DIR /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib/build/c-link-lib.build/Debug/c-link-lib.build/PrefixHeaders\r    setenv PRESERVE_DEAD_CODE_INITS_AND_TERMS NO\r    setenv PRODUCT_NAME c-link-lib\r    setenv PROFILING_CODE NO\r    setenv PROJECT c-link-lib\r    setenv PROJECT_DERIVED_FILE_DIR /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib/build/c-link-lib.build/DerivedSources\r    setenv PROJECT_DIR /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib\r    setenv PROJECT_FILE_PATH /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib/c-link-lib.xcodeproj\r    setenv PROJECT_NAME c-link-lib\r    setenv PROJECT_TEMP_DIR /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib/build/c-link-lib.build\r    setenv REMOVE_CVS_FROM_RESOURCES YES\r    setenv REMOVE_SVN_FROM_RESOURCES YES\r    setenv RUN_CLANG_STATIC_ANALYZER NO\r    setenv SCAN_ALL_SOURCE_FILES_FOR_INCLUDES NO\r    setenv SDKROOT /Developer/SDKs/MacOSX10.6.sdk\r    setenv SEPARATE_STRIP NO\r    setenv SEPARATE_SYMBOL_EDIT NO\r    setenv SHARED_DERIVED_FILE_DIR /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib/build/Debug/DerivedSources\r    setenv SHARED_PRECOMPS_DIR /var/folders/Kh/KhsdbCr-FSeYmRs916MI4k+++TI/-Caches-/com.apple.Xcode.501/SharedPrecompiledHeaders\r    setenv SKIP_INSTALL NO\r    setenv SOURCE_ROOT /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib\r    setenv SRCROOT /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib\r    setenv STANDARD_C_PLUS_PLUS_LIBRARY_TYPE dynamic\r    setenv STRINGS_FILE_OUTPUT_ENCODING UTF-16\r    setenv STRIP_INSTALLED_PRODUCT YES\r    setenv STRIP_STYLE all\r    setenv SYMROOT /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib/build\r    setenv SYSTEM_ADMIN_APPS_DIR /Applications/Utilities\r    setenv SYSTEM_APPS_DIR /Applications\r    setenv SYSTEM_CORE_SERVICES_DIR /System/Library/CoreServices\r    setenv SYSTEM_DEMOS_DIR /Applications/Extras\r    setenv SYSTEM_DEVELOPER_APPS_DIR /Developer/Applications\r    setenv SYSTEM_DEVELOPER_BIN_DIR /Developer/usr/bin\r    setenv SYSTEM_DEVELOPER_DEMOS_DIR "/Developer/Applications/Utilities/Built Examples"\r    setenv SYSTEM_DEVELOPER_DIR /Developer\r    setenv SYSTEM_DEVELOPER_DOC_DIR "/Developer/ADC Reference Library"\r    setenv SYSTEM_DEVELOPER_GRAPHICS_TOOLS_DIR "/Developer/Applications/Graphics Tools"\r    setenv SYSTEM_DEVELOPER_JAVA_TOOLS_DIR "/Developer/Applications/Java Tools"\r    setenv SYSTEM_DEVELOPER_PERFORMANCE_TOOLS_DIR "/Developer/Applications/Performance Tools"\r    setenv SYSTEM_DEVELOPER_RELEASENOTES_DIR "/Developer/ADC Reference Library/releasenotes"\r    setenv SYSTEM_DEVELOPER_TOOLS /Developer/Tools\r    setenv SYSTEM_DEVELOPER_TOOLS_DOC_DIR "/Developer/ADC Reference Library/documentation/DeveloperTools"\r    setenv SYSTEM_DEVELOPER_TOOLS_RELEASENOTES_DIR "/Developer/ADC Reference Library/releasenotes/DeveloperTools"\r    setenv SYSTEM_DEVELOPER_USR_DIR /Developer/usr\r    setenv SYSTEM_DEVELOPER_UTILITIES_DIR /Developer/Applications/Utilities\r    setenv SYSTEM_DOCUMENTATION_DIR /Library/Documentation\r    setenv SYSTEM_LIBRARY_DIR /System/Library\r    setenv TARGETNAME c-link-lib\r    setenv TARGET_BUILD_DIR /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib/build/Debug\r    setenv TARGET_NAME c-link-lib\r    setenv TARGET_TEMP_DIR /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib/build/c-link-lib.build/Debug/c-link-lib.build\r    setenv TEMP_DIR /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib/build/c-link-lib.build/Debug/c-link-lib.build\r    setenv TEMP_FILES_DIR \r    setenv TEMP_FILE_DIR /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib/build/c-link-lib.build/Debug/c-link-lib.build\r    setenv TEMP_ROOT /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib/build\r    setenv UID 501\r    setenv USER dja\r    setenv USER_APPS_DIR /Users/dja/Applications\r    setenv USER_LIBRARY_DIR /Users/dja/Library\r    setenv XCODE_APP_SUPPORT_DIR /Developer/Library/Xcode\r    setenv XCODE_VERSION_ACTUAL 0321\r    setenv XCODE_VERSION_MAJOR 0300\r    setenv XCODE_VERSION_MINOR 0320\r    /usr/bin/make\r0#
+
diff --git a/link/C/Link/c-link-lib/build/c-link-lib.build/Debug/c-link-lib.build/build-state~.dat b/link/C/Link/c-link-lib/build/c-link-lib.build/Debug/c-link-lib.build/build-state~.dat
new file mode 100644 (file)
index 0000000..b3b26c9
--- /dev/null
@@ -0,0 +1,25 @@
+Tc-link-lib
+v7
+r0
+t293418275.781544
+cCheck dependencies
+cExternalBuildToolExecution c-link-lib
+
+N/usr/bin/make
+c000000004A11964700000000000556C0
+t1242666567
+s349888
+
+CCheck dependencies
+r0
+lSLF07#2@18"Check dependencies293418275#293418275#0(0"0(0#1#0"7947009927035180032#0"0#
+
+CExternalBuildToolExecution c-link-lib
+s293418275.646762
+e293418275.781289
+r0
+xExternalBuildToolExecution
+xc-link-lib
+omake: *** No rule to make target `main.c', needed by `all'.  Stop.
+lSLF07#2@23"Run external build tool293418275#293418275#0(113"make: *** No rule to make target `main.c', needed by `all'.  Stop.\rCommand /usr/bin/make failed with exit code 2\r2(13@67"make: *** No rule to make target `main.c', needed by `all'.  Stop.\r293418275#0#67#0(1@0"0(4@45"Command /usr/bin/make failed with exit code 2293418275#18446744073709551615#0#0(1@0"0(0#0#0"18446744073709551615#9988"    cd /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib\r    setenv ACTION \r    setenv ALTERNATE_GROUP staff\r    setenv ALTERNATE_MODE u+w,go-w,a+rX\r    setenv ALTERNATE_OWNER dja\r    setenv ALWAYS_SEARCH_USER_PATHS YES\r    setenv APPLE_INTERNAL_DEVELOPER_DIR /AppleInternal/Developer\r    setenv APPLE_INTERNAL_DIR /AppleInternal\r    setenv APPLE_INTERNAL_DOCUMENTATION_DIR /AppleInternal/Documentation\r    setenv APPLE_INTERNAL_LIBRARY_DIR /AppleInternal/Library\r    setenv APPLE_INTERNAL_TOOLS /AppleInternal/Developer/Tools\r    setenv APPLY_RULES_IN_COPY_FILES NO\r    setenv ARCHS i386\r    setenv BUILD_COMPONENTS "headers build"\r    setenv BUILD_DIR /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib/build\r    setenv BUILD_ROOT /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib/build\r    setenv BUILD_STYLE Debug\r    setenv BUILD_VARIANTS normal\r    setenv BUILT_PRODUCTS_DIR /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib/build/Debug\r    setenv CACHE_ROOT /var/folders/Kh/KhsdbCr-FSeYmRs916MI4k+++TI/-Caches-/com.apple.Xcode.501\r    setenv CLASS_FILE_DIR /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib/build/c-link-lib.build/Debug/c-link-lib.build/JavaClasses\r    setenv CLONE_HEADERS NO\r    setenv CONFIGURATION Debug\r    setenv CONFIGURATION_BUILD_DIR /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib/build/Debug\r    setenv CONFIGURATION_TEMP_DIR /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib/build/c-link-lib.build/Debug\r    setenv COPYING_PRESERVES_HFS_DATA NO\r    setenv COPY_PHASE_STRIP NO\r    setenv DEAD_CODE_STRIPPING NO\r    setenv DEBUGGING_SYMBOLS YES\r    setenv DEPLOYMENT_LOCATION NO\r    setenv DEPLOYMENT_POSTPROCESSING NO\r    setenv DERIVED_FILES_DIR \r    setenv DERIVED_FILE_DIR /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib/build/c-link-lib.build/Debug/c-link-lib.build/DerivedSources\r    setenv DERIVED_SOURCES_DIR /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib/build/c-link-lib.build/Debug/c-link-lib.build/DerivedSources\r    setenv DEVELOPER_APPLICATIONS_DIR /Developer/Applications\r    setenv DEVELOPER_BIN_DIR /Developer/usr/bin\r    setenv DEVELOPER_DIR /Developer\r    setenv DEVELOPER_FRAMEWORKS_DIR /Developer/Library/Frameworks\r    setenv DEVELOPER_FRAMEWORKS_DIR_QUOTED "\"/Developer/Library/Frameworks\""\r    setenv DEVELOPER_LIBRARY_DIR /Developer/Library\r    setenv DEVELOPER_SDK_DIR /Developer/SDKs\r    setenv DEVELOPER_TOOLS_DIR /Developer/Tools\r    setenv DEVELOPER_USR_DIR /Developer/usr\r    setenv DEVELOPMENT_LANGUAGE English\r    setenv DO_HEADER_SCANNING_IN_JAM NO\r    setenv DSTROOT /tmp/c-link-lib.dst\r    setenv DWARF_DSYM_FILE_NAME .dSYM\r    setenv DWARF_DSYM_FOLDER_PATH /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib/build/Debug\r    setenv ENABLE_HEADER_DEPENDENCIES YES\r    setenv ENABLE_OPENMP_SUPPORT NO\r    setenv EXCLUDED_INSTALLSRC_SUBDIRECTORY_PATTERNS ".svn CVS"\r    setenv EXCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES "*.nib *.lproj *.framework *.gch *.xcode* (*) CVS .svn"\r    setenv FILE_LIST /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib/build/c-link-lib.build/Debug/c-link-lib.build/Objects/LinkFileList\r    setenv FRAMEWORK_VERSION A\r    setenv GCC3_VERSION 3.3\r    setenv GCC_DYNAMIC_NO_PIC NO\r    setenv GCC_ENABLE_FIX_AND_CONTINUE YES\r    setenv GCC_GENERATE_DEBUGGING_SYMBOLS YES\r    setenv GCC_OPTIMIZATION_LEVEL 0\r    setenv GCC_WARN_ABOUT_RETURN_TYPE YES\r    setenv GCC_WARN_UNUSED_VARIABLE YES\r    setenv GENERATE_MASTER_OBJECT_FILE NO\r    setenv GENERATE_PKGINFO_FILE NO\r    setenv GID 20\r    setenv GROUP staff\r    setenv HEADERMAP_INCLUDES_FLAT_ENTRIES_FOR_TARGET_BEING_BUILT YES\r    setenv HEADERMAP_INCLUDES_FRAMEWORK_ENTRIES_FOR_ALL_PRODUCT_TYPES YES\r    setenv HEADERMAP_INCLUDES_NONPUBLIC_NONPRIVATE_HEADERS YES\r    setenv HEADERMAP_INCLUDES_PROJECT_HEADERS YES\r    setenv INFOPLIST_EXPAND_BUILD_SETTINGS YES\r    setenv INFOPLIST_OUTPUT_FORMAT same-as-input\r    setenv INFOPLIST_PREPROCESS NO\r    setenv INSTALL_DIR /tmp/c-link-lib.dst\r    setenv INSTALL_GROUP staff\r    setenv INSTALL_MODE_FLAG u+w,go-w,a+rX\r    setenv INSTALL_OWNER dja\r    setenv INSTALL_ROOT /tmp/c-link-lib.dst\r    setenv JAVA_APP_STUB /System/Library/Frameworks/JavaVM.framework/Resources/MacOS/JavaApplicationStub\r    setenv JAVA_ARCHIVE_CLASSES YES\r    setenv JAVA_ARCHIVE_TYPE JAR\r    setenv JAVA_COMPILER /usr/bin/javac\r    setenv JAVA_FRAMEWORK_RESOURCES_DIRS Resources\r    setenv JAVA_JAR_FLAGS cv\r    setenv JAVA_SOURCE_SUBDIR .\r    setenv JAVA_USE_DEPENDENCIES YES\r    setenv JAVA_ZIP_FLAGS -urg\r    setenv KEEP_PRIVATE_EXTERNS NO\r    setenv LD_GENERATE_MAP_FILE NO\r    setenv LD_MAP_FILE_PATH /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib/build/c-link-lib.build/Debug/c-link-lib.build/c-link-lib-LinkMap--.txt\r    setenv LD_OPENMP_FLAGS -fopenmp\r    setenv LINKER_DISPLAYS_MANGLED_NAMES NO\r    setenv LINK_WITH_STANDARD_LIBRARIES YES\r    setenv LOCAL_ADMIN_APPS_DIR /Applications/Utilities\r    setenv LOCAL_APPS_DIR /Applications\r    setenv LOCAL_DEVELOPER_DIR /Library/Developer\r    setenv LOCAL_LIBRARY_DIR /Library\r    setenv MACOSX_DEPLOYMENT_TARGET 10.6\r    setenv MAC_OS_X_VERSION_ACTUAL 1063\r    setenv MAC_OS_X_VERSION_MAJOR 1060\r    setenv MAC_OS_X_VERSION_MINOR 0603\r    setenv OBJECT_FILE_DIR /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib/build/c-link-lib.build/Debug/c-link-lib.build/Objects\r    setenv OBJROOT /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib/build\r    setenv ONLY_ACTIVE_ARCH YES\r    setenv OPTIMIZATION_LEVEL 0\r    setenv OS MACOS\r    setenv PATH_PREFIXES_EXCLUDED_FROM_HEADER_DEPENDENCIES "/usr/include /usr/local/include /System/Library/Frameworks /System/Library/PrivateFrameworks /Developer/Headers /Developer/SDKs /Developer/Platforms"\r    setenv PLIST_FILE_OUTPUT_FORMAT same-as-input\r    setenv PREBINDING NO\r    setenv PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR YES\r    setenv PRECOMP_DESTINATION_DIR /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib/build/c-link-lib.build/Debug/c-link-lib.build/PrefixHeaders\r    setenv PRESERVE_DEAD_CODE_INITS_AND_TERMS NO\r    setenv PRODUCT_NAME c-link-lib\r    setenv PROFILING_CODE NO\r    setenv PROJECT c-link-lib\r    setenv PROJECT_DERIVED_FILE_DIR /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib/build/c-link-lib.build/DerivedSources\r    setenv PROJECT_DIR /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib\r    setenv PROJECT_FILE_PATH /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib/c-link-lib.xcodeproj\r    setenv PROJECT_NAME c-link-lib\r    setenv PROJECT_TEMP_DIR /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib/build/c-link-lib.build\r    setenv REMOVE_CVS_FROM_RESOURCES YES\r    setenv REMOVE_SVN_FROM_RESOURCES YES\r    setenv RUN_CLANG_STATIC_ANALYZER NO\r    setenv SCAN_ALL_SOURCE_FILES_FOR_INCLUDES NO\r    setenv SDKROOT /Developer/SDKs/MacOSX10.6.sdk\r    setenv SEPARATE_STRIP NO\r    setenv SEPARATE_SYMBOL_EDIT NO\r    setenv SHARED_DERIVED_FILE_DIR /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib/build/Debug/DerivedSources\r    setenv SHARED_PRECOMPS_DIR /var/folders/Kh/KhsdbCr-FSeYmRs916MI4k+++TI/-Caches-/com.apple.Xcode.501/SharedPrecompiledHeaders\r    setenv SKIP_INSTALL NO\r    setenv SOURCE_ROOT /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib\r    setenv SRCROOT /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib\r    setenv STANDARD_C_PLUS_PLUS_LIBRARY_TYPE dynamic\r    setenv STRINGS_FILE_OUTPUT_ENCODING UTF-16\r    setenv STRIP_INSTALLED_PRODUCT YES\r    setenv STRIP_STYLE all\r    setenv SYMROOT /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib/build\r    setenv SYSTEM_ADMIN_APPS_DIR /Applications/Utilities\r    setenv SYSTEM_APPS_DIR /Applications\r    setenv SYSTEM_CORE_SERVICES_DIR /System/Library/CoreServices\r    setenv SYSTEM_DEMOS_DIR /Applications/Extras\r    setenv SYSTEM_DEVELOPER_APPS_DIR /Developer/Applications\r    setenv SYSTEM_DEVELOPER_BIN_DIR /Developer/usr/bin\r    setenv SYSTEM_DEVELOPER_DEMOS_DIR "/Developer/Applications/Utilities/Built Examples"\r    setenv SYSTEM_DEVELOPER_DIR /Developer\r    setenv SYSTEM_DEVELOPER_DOC_DIR "/Developer/ADC Reference Library"\r    setenv SYSTEM_DEVELOPER_GRAPHICS_TOOLS_DIR "/Developer/Applications/Graphics Tools"\r    setenv SYSTEM_DEVELOPER_JAVA_TOOLS_DIR "/Developer/Applications/Java Tools"\r    setenv SYSTEM_DEVELOPER_PERFORMANCE_TOOLS_DIR "/Developer/Applications/Performance Tools"\r    setenv SYSTEM_DEVELOPER_RELEASENOTES_DIR "/Developer/ADC Reference Library/releasenotes"\r    setenv SYSTEM_DEVELOPER_TOOLS /Developer/Tools\r    setenv SYSTEM_DEVELOPER_TOOLS_DOC_DIR "/Developer/ADC Reference Library/documentation/DeveloperTools"\r    setenv SYSTEM_DEVELOPER_TOOLS_RELEASENOTES_DIR "/Developer/ADC Reference Library/releasenotes/DeveloperTools"\r    setenv SYSTEM_DEVELOPER_USR_DIR /Developer/usr\r    setenv SYSTEM_DEVELOPER_UTILITIES_DIR /Developer/Applications/Utilities\r    setenv SYSTEM_DOCUMENTATION_DIR /Library/Documentation\r    setenv SYSTEM_LIBRARY_DIR /System/Library\r    setenv TARGETNAME c-link-lib\r    setenv TARGET_BUILD_DIR /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib/build/Debug\r    setenv TARGET_NAME c-link-lib\r    setenv TARGET_TEMP_DIR /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib/build/c-link-lib.build/Debug/c-link-lib.build\r    setenv TEMP_DIR /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib/build/c-link-lib.build/Debug/c-link-lib.build\r    setenv TEMP_FILES_DIR \r    setenv TEMP_FILE_DIR /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib/build/c-link-lib.build/Debug/c-link-lib.build\r    setenv TEMP_ROOT /Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib/build\r    setenv UID 501\r    setenv USER dja\r    setenv USER_APPS_DIR /Users/dja/Applications\r    setenv USER_LIBRARY_DIR /Users/dja/Library\r    setenv XCODE_APP_SUPPORT_DIR /Developer/Library/Xcode\r    setenv XCODE_VERSION_ACTUAL 0321\r    setenv XCODE_VERSION_MAJOR 0300\r    setenv XCODE_VERSION_MINOR 0320\r    /usr/bin/make\r2#
+
diff --git a/link/C/Link/c-link-lib/build/c-link-lib.build/Debug/c-link-lib.build/c-link-lib.dep b/link/C/Link/c-link-lib/build/c-link-lib.build/Debug/c-link-lib.build/c-link-lib.dep
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/link/C/Link/c-link-lib/build/c-link-lib.build/Debug/c-link-lib.build/c-link-lib~.dep b/link/C/Link/c-link-lib/build/c-link-lib.build/Debug/c-link-lib.build/c-link-lib~.dep
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/link/C/Link/c-link-lib/build/c-link-lib.build/c-link-lib.pbxindex/categories.pbxbtree b/link/C/Link/c-link-lib/build/c-link-lib.build/c-link-lib.pbxindex/categories.pbxbtree
new file mode 100644 (file)
index 0000000..d3f6bb3
Binary files /dev/null and b/link/C/Link/c-link-lib/build/c-link-lib.build/c-link-lib.pbxindex/categories.pbxbtree differ
diff --git a/link/C/Link/c-link-lib/build/c-link-lib.build/c-link-lib.pbxindex/cdecls.pbxbtree b/link/C/Link/c-link-lib/build/c-link-lib.build/c-link-lib.pbxindex/cdecls.pbxbtree
new file mode 100644 (file)
index 0000000..a203d5c
Binary files /dev/null and b/link/C/Link/c-link-lib/build/c-link-lib.build/c-link-lib.pbxindex/cdecls.pbxbtree differ
diff --git a/link/C/Link/c-link-lib/build/c-link-lib.build/c-link-lib.pbxindex/decls.pbxbtree b/link/C/Link/c-link-lib/build/c-link-lib.build/c-link-lib.pbxindex/decls.pbxbtree
new file mode 100644 (file)
index 0000000..48a4363
Binary files /dev/null and b/link/C/Link/c-link-lib/build/c-link-lib.build/c-link-lib.pbxindex/decls.pbxbtree differ
diff --git a/link/C/Link/c-link-lib/build/c-link-lib.build/c-link-lib.pbxindex/files.pbxbtree b/link/C/Link/c-link-lib/build/c-link-lib.build/c-link-lib.pbxindex/files.pbxbtree
new file mode 100644 (file)
index 0000000..12ce1e4
Binary files /dev/null and b/link/C/Link/c-link-lib/build/c-link-lib.build/c-link-lib.pbxindex/files.pbxbtree differ
diff --git a/link/C/Link/c-link-lib/build/c-link-lib.build/c-link-lib.pbxindex/imports.pbxbtree b/link/C/Link/c-link-lib/build/c-link-lib.build/c-link-lib.pbxindex/imports.pbxbtree
new file mode 100644 (file)
index 0000000..0602e14
Binary files /dev/null and b/link/C/Link/c-link-lib/build/c-link-lib.build/c-link-lib.pbxindex/imports.pbxbtree differ
diff --git a/link/C/Link/c-link-lib/build/c-link-lib.build/c-link-lib.pbxindex/pbxindex.header b/link/C/Link/c-link-lib/build/c-link-lib.build/c-link-lib.pbxindex/pbxindex.header
new file mode 100644 (file)
index 0000000..1cafa72
Binary files /dev/null and b/link/C/Link/c-link-lib/build/c-link-lib.build/c-link-lib.pbxindex/pbxindex.header differ
diff --git a/link/C/Link/c-link-lib/build/c-link-lib.build/c-link-lib.pbxindex/protocols.pbxbtree b/link/C/Link/c-link-lib/build/c-link-lib.build/c-link-lib.pbxindex/protocols.pbxbtree
new file mode 100644 (file)
index 0000000..d3f6bb3
Binary files /dev/null and b/link/C/Link/c-link-lib/build/c-link-lib.build/c-link-lib.pbxindex/protocols.pbxbtree differ
diff --git a/link/C/Link/c-link-lib/build/c-link-lib.build/c-link-lib.pbxindex/refs.pbxbtree b/link/C/Link/c-link-lib/build/c-link-lib.build/c-link-lib.pbxindex/refs.pbxbtree
new file mode 100644 (file)
index 0000000..e2ff6aa
Binary files /dev/null and b/link/C/Link/c-link-lib/build/c-link-lib.build/c-link-lib.pbxindex/refs.pbxbtree differ
diff --git a/link/C/Link/c-link-lib/build/c-link-lib.build/c-link-lib.pbxindex/strings.pbxstrings/control b/link/C/Link/c-link-lib/build/c-link-lib.build/c-link-lib.pbxindex/strings.pbxstrings/control
new file mode 100644 (file)
index 0000000..6aa0637
Binary files /dev/null and b/link/C/Link/c-link-lib/build/c-link-lib.build/c-link-lib.pbxindex/strings.pbxstrings/control differ
diff --git a/link/C/Link/c-link-lib/build/c-link-lib.build/c-link-lib.pbxindex/strings.pbxstrings/strings b/link/C/Link/c-link-lib/build/c-link-lib.build/c-link-lib.pbxindex/strings.pbxstrings/strings
new file mode 100644 (file)
index 0000000..ff1e2c3
Binary files /dev/null and b/link/C/Link/c-link-lib/build/c-link-lib.build/c-link-lib.pbxindex/strings.pbxstrings/strings differ
diff --git a/link/C/Link/c-link-lib/build/c-link-lib.build/c-link-lib.pbxindex/subclasses.pbxbtree b/link/C/Link/c-link-lib/build/c-link-lib.build/c-link-lib.pbxindex/subclasses.pbxbtree
new file mode 100644 (file)
index 0000000..124d157
Binary files /dev/null and b/link/C/Link/c-link-lib/build/c-link-lib.build/c-link-lib.pbxindex/subclasses.pbxbtree differ
diff --git a/link/C/Link/c-link-lib/build/c-link-lib.build/c-link-lib.pbxindex/symbols0.pbxsymbols b/link/C/Link/c-link-lib/build/c-link-lib.build/c-link-lib.pbxindex/symbols0.pbxsymbols
new file mode 100644 (file)
index 0000000..12ca153
Binary files /dev/null and b/link/C/Link/c-link-lib/build/c-link-lib.build/c-link-lib.pbxindex/symbols0.pbxsymbols differ
diff --git a/link/C/Link/c-link-lib/c-link-lib.xcodeproj/project.pbxproj b/link/C/Link/c-link-lib/c-link-lib.xcodeproj/project.pbxproj
new file mode 100644 (file)
index 0000000..97722b7
--- /dev/null
@@ -0,0 +1,148 @@
+// !$*UTF8*$!
+{
+       archiveVersion = 1;
+       classes = {
+       };
+       objectVersion = 45;
+       objects = {
+
+/* Begin PBXFileReference section */
+               224F59A1117D6473003D9540 /* c-angel.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "c-angel.c"; path = "sample-agents/c-angel.c"; sourceTree = "<group>"; };
+               224F59B9117D6D88003D9540 /* c-lucifer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "c-lucifer.c"; path = "sample-agents/c-lucifer.c"; sourceTree = "<group>"; };
+               224F59BA117D889A003D9540 /* c-streetfighter.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "c-streetfighter.c"; path = "sample-agents/c-streetfighter.c"; sourceTree = "<group>"; };
+               22F652F5117C679300A3793D /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
+               22F652F6117C6C9500A3793D /* c-link.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "c-link.h"; sourceTree = "<group>"; };
+               22F652F7117C6C9500A3793D /* c-link.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "c-link.c"; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXGroup section */
+               08FB7794FE84155DC02AAC07 /* c-link-lib */ = {
+                       isa = PBXGroup;
+                       children = (
+                               224F59A3117D64B4003D9540 /* Sample Agents */,
+                               22F652F6117C6C9500A3793D /* c-link.h */,
+                               22F652F7117C6C9500A3793D /* c-link.c */,
+                               22F652F5117C679300A3793D /* Makefile */,
+                       );
+                       name = "c-link-lib";
+                       sourceTree = "<group>";
+               };
+               224F59A3117D64B4003D9540 /* Sample Agents */ = {
+                       isa = PBXGroup;
+                       children = (
+                               224F59B9117D6D88003D9540 /* c-lucifer.c */,
+                               224F59BA117D889A003D9540 /* c-streetfighter.c */,
+                               224F59A1117D6473003D9540 /* c-angel.c */,
+                       );
+                       name = "Sample Agents";
+                       sourceTree = "<group>";
+               };
+/* End PBXGroup section */
+
+/* Begin PBXLegacyTarget section */
+               D28A88AD04BDD90700651E21 /* c-link-lib */ = {
+                       isa = PBXLegacyTarget;
+                       buildArgumentsString = "$(ACTION)";
+                       buildConfigurationList = 1DEB918F08733D9F0010E9CD /* Build configuration list for PBXLegacyTarget "c-link-lib" */;
+                       buildPhases = (
+                       );
+                       buildToolPath = /usr/bin/make;
+                       buildWorkingDirectory = "/Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib";
+                       dependencies = (
+                       );
+                       name = "c-link-lib";
+                       passBuildSettingsInEnvironment = 1;
+                       productName = "c-link-lib";
+               };
+/* End PBXLegacyTarget section */
+
+/* Begin PBXProject section */
+               08FB7793FE84155DC02AAC07 /* Project object */ = {
+                       isa = PBXProject;
+                       buildConfigurationList = 1DEB919308733D9F0010E9CD /* Build configuration list for PBXProject "c-link-lib" */;
+                       compatibilityVersion = "Xcode 3.1";
+                       hasScannedForEncodings = 1;
+                       mainGroup = 08FB7794FE84155DC02AAC07 /* c-link-lib */;
+                       projectDirPath = "";
+                       projectRoot = "";
+                       targets = (
+                               D28A88AD04BDD90700651E21 /* c-link-lib */,
+                       );
+               };
+/* End PBXProject section */
+
+/* Begin XCBuildConfiguration section */
+               1DEB919008733D9F0010E9CD /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = NO;
+                               DEBUGGING_SYMBOLS = YES;
+                               GCC_DYNAMIC_NO_PIC = NO;
+                               GCC_ENABLE_FIX_AND_CONTINUE = YES;
+                               GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+                               GCC_OPTIMIZATION_LEVEL = 0;
+                               OTHER_CFLAGS = "";
+                               OTHER_LDFLAGS = "";
+                               PRODUCT_NAME = "c-link-lib";
+                       };
+                       name = Debug;
+               };
+               1DEB919108733D9F0010E9CD /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = YES;
+                               GCC_ENABLE_FIX_AND_CONTINUE = NO;
+                               OTHER_CFLAGS = "";
+                               OTHER_LDFLAGS = "";
+                               PRODUCT_NAME = "c-link-lib";
+                       };
+                       name = Release;
+               };
+               1DEB919408733D9F0010E9CD /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+                               GCC_WARN_ABOUT_RETURN_TYPE = YES;
+                               GCC_WARN_UNUSED_VARIABLE = YES;
+                               ONLY_ACTIVE_ARCH = YES;
+                               PREBINDING = NO;
+                               SDKROOT = macosx10.6;
+                       };
+                       name = Debug;
+               };
+               1DEB919508733D9F0010E9CD /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+                               GCC_WARN_ABOUT_RETURN_TYPE = YES;
+                               GCC_WARN_UNUSED_VARIABLE = YES;
+                               PREBINDING = NO;
+                               SDKROOT = macosx10.6;
+                       };
+                       name = Release;
+               };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+               1DEB918F08733D9F0010E9CD /* Build configuration list for PBXLegacyTarget "c-link-lib" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               1DEB919008733D9F0010E9CD /* Debug */,
+                               1DEB919108733D9F0010E9CD /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               1DEB919308733D9F0010E9CD /* Build configuration list for PBXProject "c-link-lib" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               1DEB919408733D9F0010E9CD /* Debug */,
+                               1DEB919508733D9F0010E9CD /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+/* End XCConfigurationList section */
+       };
+       rootObject = 08FB7793FE84155DC02AAC07 /* Project object */;
+}
diff --git a/link/C/Link/c-link-lib/c-link.c b/link/C/Link/c-link-lib/c-link.c
new file mode 100644 (file)
index 0000000..b7d6285
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+ *  c-link.c
+ *  c-link-lib
+ *
+ *  Created by Daniel Axtens on 19/04/10.
+ *  Licensed under an MIT-style license: see the LICENSE file for details.
+ *
+ */
+
+#include "c-link.h"
+#include <stdlib.h>
+
+ITEMTYPE RandomAttack() {
+       return (ITEMTYPE)rand()%3;
+}
+
+
+int main( int argc, char * argv[] ) {
+       srand( time( NULL ) );
+       return 0;
+}
\ No newline at end of file
diff --git a/link/C/Link/c-link-lib/c-link.h b/link/C/Link/c-link-lib/c-link.h
new file mode 100644 (file)
index 0000000..b53b90e
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ *  c-link.h
+ *  c-link-lib
+ *
+ *  Created by Daniel Axtens on 19/04/10.
+ *  Licensed under an MIT-style license: see the LICENSE file for details.
+ *
+ */
+
+/********** Type definitions **********/
+
+/* The type of item used in an attack or defence */
+typedef enum {rock, paper, scissors} ITEMTYPE;
+
+
+/* An attack, consisting of the real attack and the attack promised */
+typedef struct {
+       ITEMTYPE realAttack;
+       ITEMTYPE promisedAttack;
+} ATTACKTYPE;
+
+/********** Utility Function definitions **********/
+
+/* Returns a random item */
+
+ITEMTYPE RandomAttack();
+
+/********** Bot Function definitions **********/
+
+/* Defend( foeName : string - the name of your foe;
+           foePromisedAttack : ITEMTYPE - the item your foe promised to use
+         ) : ITEMTYPE - the item you wish to use to defend;
+ Called when your agent needs to defend itself.
+ */
+ITEMTYPE Defend( char * foeName, ITEMTYPE foePromisedAttack );
+
+
+/* Attack( foeName : string - the name of your foe
+                ) : ATTACKTYPE - the real and promised attack you wish to use
+
+ Called when your agent needs to attack another agent.
+ */
+ATTACKTYPE Attack( char * foeName );
+
+
+/* Results( foeName : string - the name of your foe;
+            isInstigatedByYou : 0=you defended/1=you attacked;
+                       yourItem : ITEMTYPE - the item you used;
+            theirItem : ITEMTYPE - the item they used;
+            promisedItem : ITEMTYPE - the item that was promised
+          );
+
+ Called after your agent battles another agent, to tell you how the battle goes.
+ */
+void Results( char * foeName, int isInstigatedByYou, ITEMTYPE yourItem, 
+                         ITEMTYPE theirItem, ITEMTYPE promisedItem);
\ No newline at end of file
diff --git a/link/C/Link/c-link-lib/c-link.o b/link/C/Link/c-link-lib/c-link.o
new file mode 100644 (file)
index 0000000..facc4cb
Binary files /dev/null and b/link/C/Link/c-link-lib/c-link.o differ
diff --git a/link/C/Link/c-link-lib/link.o b/link/C/Link/c-link-lib/link.o
new file mode 100644 (file)
index 0000000..facc4cb
Binary files /dev/null and b/link/C/Link/c-link-lib/link.o differ
diff --git a/link/C/Link/c-link-lib/rps-c b/link/C/Link/c-link-lib/rps-c
new file mode 100755 (executable)
index 0000000..17d99e7
Binary files /dev/null and b/link/C/Link/c-link-lib/rps-c differ
diff --git a/link/C/Link/c-link-lib/sample-agents/c-angel.c b/link/C/Link/c-link-lib/sample-agents/c-angel.c
new file mode 100644 (file)
index 0000000..661d1fb
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ *  c-angel.c
+ *  c-link-lib
+ *
+ *  Created by Daniel Axtens on 20/04/10.
+ *  Licensed under an MIT-style license: see the LICENSE file for details.
+ *
+ */
+
+#include <c-link.h>
+
+/* Implement the angel bot, which always tells the truth
+   and expects others to do the same */
+
+ATTACKTYPE Attack( char * foe_name ) {
+       ATTACKTYPE attack;
+       
+       attack.realAttack =  RandomAttack();            /* Chooses randomly from Rock, Paper, Scissors */ 
+       attack.promisedAttack = result.realAttack;      /* Tells the truth for its bluff */
+
+       return attack;
+}
+
+ITEMTYPE Defend( char * foeName, ITEMTYPE foePromisedAttack ) {
+       return foePromisedAttack;       /* Trusts them to be going for a tie */
+}
+
+/* You need to define a results function, even if it isn't used
+   (otherwise the linker will complain) */
+void Results( char * foeName, int isInstigatedByYou, ITEMTYPE yourItem, 
+                        ITEMTYPE theirItem, ITEMTYPE promisedItem) {
+       
+       return; /* Ignore whatever just happened. */
+}
\ No newline at end of file
diff --git a/link/C/Link/c-link-lib/sample-agents/c-lucifer.c b/link/C/Link/c-link-lib/sample-agents/c-lucifer.c
new file mode 100644 (file)
index 0000000..2b9da08
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ *  c-lucifer.c
+ *  c-link-lib
+ *
+ *  Created by Daniel Axtens on 20/04/10.
+ *  Licensed under an MIT-style license: see the LICENSE file for details.
+ *
+ */
+
+
+#include <c-link.h>
+
+/* Implement the lucifer bot, which always lies expecting people to be good
+   and always goes for the kill */
+
+ATTACKTYPE Attack( char * foe_name ) {
+       ATTACKTYPE attack;
+       
+       attack.realAttack =  RandomAttack();
+       
+       /* Here we choose the thing that will hurt them if they go for a tie */
+       switch (attack.realAttack) {
+               case rock:
+                       result.promisedAttack = scissors;
+                       break;
+               case paper:
+                       result.promisedAttack = rock;
+                       break;
+               default: /* attack = scissors */
+                       result.promisedAttack = paper;
+                       break;
+       }
+       attack.promisedAttack = result.realAttack;      /* Tells the truth for its bluff */
+       
+       return attack;
+}
+
+/* Here we trust that they are telling the truth. And we try to kill them. */
+ITEMTYPE Defend( char * foeName, ITEMTYPE foePromisedAttack ) {
+       ITEMTYPE defence;
+       switch (foePromisedAttack) {
+               case rock:
+                       defence = paper;
+                       break;
+               case paper:
+                       defence = scissors;
+                       break;
+               default:
+                       defence = rock;
+                       break;
+       }
+}
+
+/* You need to define a results function, even if it isn't used
+ (otherwise the linker will complain) */
+void Results( char * foeName, int isInstigatedByYou, ITEMTYPE yourItem, 
+                        ITEMTYPE theirItem, ITEMTYPE promisedItem) {
+       
+       return; /* Ignore whatever just happened. */
+}
\ No newline at end of file
diff --git a/link/C/Link/c-link-lib/sample-agents/c-streetfighter.c b/link/C/Link/c-link-lib/sample-agents/c-streetfighter.c
new file mode 100644 (file)
index 0000000..2841f43
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ *  c-streetfighter.c
+ *  c-link-lib
+ *
+ *  Created by Daniel Axtens on 20/04/10.
+ *  Licensed under an MIT-style license: see the LICENSE file for details.
+ *
+ */
+
+
+#include <c-link.h>
+
+/* Implement the streetfighter bot, which thinks everyone has it in for him. */
+
+ATTACKTYPE Attack( char * foe_name ) {
+       ATTACKTYPE attack;
+       
+       attack.realAttack =  RandomAttack();
+       
+       /* Here we choose the thing that will hurt them if they go for a tie */
+       switch (attack.realAttack) {
+               case rock:
+                       result.promisedAttack = paper;
+                       break;
+               case paper:
+                       result.promisedAttack = rock;
+                       break;
+               default: /* attack = scissors */
+                       result.promisedAttack = paper;
+                       break;
+       }
+       attack.promisedAttack = result.realAttack;      /* Tells the truth for its bluff */
+       
+       return attack;
+}
+
+/* Here we trust that they are telling the truth. And we try to kill them. */
+ITEMTYPE Defend( char * foeName, ITEMTYPE foePromisedAttack ) {
+       ITEMTYPE defence;
+       switch (foePromisedAttack) {
+               case rock:
+                       defence = paper;
+                       break;
+               case paper:
+                       defence = scissors;
+                       break;
+               default:
+                       defence = rock;
+                       break;
+       }
+}
+
+/* You need to define a results function, even if it isn't used
+ (otherwise the linker will complain) */
+void Results( char * foeName, int isInstigatedByYou, ITEMTYPE yourItem, 
+                        ITEMTYPE theirItem, ITEMTYPE promisedItem) {
+       
+       return; /* Ignore whatever just happened. */
+}
diff --git a/link/Mathematica/pyml.tar.gz b/link/Mathematica/pyml.tar.gz
new file mode 100644 (file)
index 0000000..498748f
Binary files /dev/null and b/link/Mathematica/pyml.tar.gz differ
diff --git a/link/Mathematica/pythonika-1.0.tar.gz b/link/Mathematica/pythonika-1.0.tar.gz
new file mode 100644 (file)
index 0000000..6611f5d
Binary files /dev/null and b/link/Mathematica/pythonika-1.0.tar.gz differ
diff --git a/proposal.txt b/proposal.txt
new file mode 100644 (file)
index 0000000..376eba9
--- /dev/null
@@ -0,0 +1,111 @@
+Wouldn't it be nice to do the programming competition again this year? I have 
+an idea that's simple enough for the non-programmer to have a good chance at 
+winning yet allows deep complexity for anyone keen to get their hands dirty.
+
+The Game
+--------
+My idea is inspired by the classic iterated Prisoner's Dilemma problem in game 
+theory. The premise is to write an "agent" to survive and thrive in the morally 
+bankrupt RockPaperScissors (RPS) land.
+
+Your agent spends its life in a dystopian RPS underworld, where at any moment 
+another agent could pick a fight with it, after which your agent is obliged to 
+pick a fight with yet another. In RPS battle, the instigating agent gets a 
+chance (which he must use) to tell the truth or lie about which tool he is 
+going to use (rock, paper, or scissors). Agents start off with 10 points, and 
+gain and lose points when they win, lose and tie a round depending on the 
+circumstances of the fight. The points table is in the technicalities 
+document:
+
+http://shmookey.ucc.asn.au/technicalities
+
+Synopsis: if an agent gets picked on for a fight and told rock, paper or 
+scissors, it can either get modest but mutually beneficial points by trying to 
+cause a tie, but risk being slaughtered by the other if it's lying (with a 
+small amount of points awarded if it wins "by accident"), or it can try to win 
+based on that information and get big points for exploiting the other agent 
+with a relatively small punishment for being "tricked" and losing (and no point 
+change in case of an "accidental" tie).
+
+Thus, in any single round there are bigger rewards and smaller consequences in 
+"attacking" the rock, paper or scissors that the enemy agent claims it will 
+use, but cooperation leads to mutual benefit and good agents should turn 
+against agents that try to exploit them.
+
+If the agent loses all its points, it dies. If it reaches 20 points, it forms a 
+new agent and both return to 10 points. The agent can remember who it has 
+battled in the past and what the other agent has done, but it has no way of 
+communicating this to any other agent, and any "children" of the agent don't 
+inherit this memory.
+
+Winning Conditions
+------------------
+The object of the game is for the descendants of your agent to be the dominant 
+species in an evolutionarily stable environment. The environment is declared 
+evolutionarily stable when the proportions of species populations remains the 
+same (with a tolerance of 5%) over ten thousand iterations, or if there is only 
+once species remaining, or if the judges say so.
+
+There will be a prize for the winner consisting of whatever we can scrounge up 
+plus a special certificate you can keep forever and frame and love. Entrants 
+whose species survive to evolutionary stability will also receive a 
+certificate.
+
+Entry Cost
+----------
+The cost of entry per person is $3 for UCC members and $5 for everyone else. 
+Your entry may contain one (1) agent and you may only enter once. UCC reserves 
+the right to withdraw any agent without refund if it causes technical or 
+administrative difficulty, after a reasonable attempt at resolution is made.
+
+Non-Programmers and Beginners
+-----------------------------
+There will be simple sample agents available that demonstrate how easy it 
+is to turn your idea into code. If you're able to visualise your idea as a 
+series of instructions you might tell a small child, you'll be able to 
+make it into an agent.
+
+If you don't understand the next section, don't worry, modifying the samples to 
+do your bidding will work just as well as writing your agent from scratch.
+
+Technical Details
+-----------------
+The challenge will be operated by a supervisor module that picks the fights in 
+a "fair" way such that each agent gets to fight every other agent (supposing no 
+agents die) and each agent gets to see battle as frequently as possible. The 
+supervisor will be able to do any number of iterations in one go, after which 
+statistics can be gathered before doing the next set of iterations.
+
+The easiest way to create an agent is with Python. Python is a popular 
+scripting language with a simple, easy to pick up syntax that resembles 
+pseudocode, and is well-adapted to this kind of task. Another advantage to 
+using Python is that the supervisor can talk to the agent directly, and the 
+programmer will not have to worry about maintaining state or validating input 
+and output. A Python agent should be a class that implements at least the 
+specification laid out in the technicalities document:
+
+http://shmookey.ucc.asn.au/technicalities
+
+The supervisor will store the number of points the agent has and the 
+number of children for your convenience. Your module may use any resource 
+available in the standard Python distribution. You are expected to use 
+member variables of your class to keep state.
+
+You can use any language you like for your agent, really. Interfacing to 
+non-python agents is via stdin/stdout, so your language's builtin print and 
+read functions will work, but beware: if an agent makes a single mistake in its 
+input or output, the supervisor will declare it insane - which in 
+RockPaperScissors land carries the death penalty. The format of the input and 
+output is documented in the technicalities document:
+
+http://shmookey.ucc.asn.au/technicalities
+
+The agent is run once per instance and is expected to maintain its own state. 
+Not maintaining state correctly could lead to a very confused agent, left 
+wondering why it's not dead, or why the baby hasn't come. Don't leave your 
+agent wondering.
+
+A sample agent in Python, Java and C will be provided. Your agent does not have 
+to be open-source, but it must be submitted as source-code to prevent cheating. 
+If the agent is not in Python, build instructions must also be submitted.
+
diff --git a/rps/trunk/LICENSE b/rps/trunk/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/rps/trunk/README b/rps/trunk/README
new file mode 100644 (file)
index 0000000..8587cf5
--- /dev/null
@@ -0,0 +1,66 @@
+Hi there,
+
+Thanks for taking interest in the UCC Programming Competition 2008. If you 
+don't already know what it's all about, check out the information provided in 
+the docs directory, which contains a full and authoritative* description for
+the running of the competition.
+
+This file is by no means complete, and not ready for circulation.
+
+The first thing you'll probably want to do is see it work. Try running:
+
+./simulate -v
+
+to see the sample agents duke it out for up to 150 rounds (the current sample
+agents suck - rounds either go for seconds or for ages). After that, take a
+look at sampleAgents.py to see how agents are implemented on top of the
+BaseAgent and LearningAgent classes. When you're ready to try out your own,
+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.
diff --git a/rps/trunk/SampleAgents.py b/rps/trunk/SampleAgents.py
new file mode 100644 (file)
index 0000000..6da30ba
--- /dev/null
@@ -0,0 +1,89 @@
+'''SampleAgents.py - A collection of sample agents for playing Rock Paper Scissors.
+Written by Luke Williams <[email protected]> for the UCC Programming Competition in 2008.
+Requires Python 2.5.
+
+Licensed under an MIT-style license: see the LICENSE file for details.
+'''
+
+from uccProgComp import BaseAgent, LearningAgent, RandomAttack
+from rpsconst import *
+
+# Angel is a very simple bot that always tells the truth and expects others to do the same.
+class Dummy (BaseAgent):
+       def Attack (self, foe):
+               return Paper, Paper
+       def Defend (self, foe, bluff):
+               return bluff
+
+class Angel (BaseAgent):
+       def Attack (self, foe):
+               attack = RandomAttack ()        # Chooses randomly from Rock, Paper, Scissors
+               return attack, attack           # Tells the truth for its bluff.
+       def Defend (self, foe, bluff):
+               return bluff                    # Trusts them to be going for a tie.
+
+# Lucifer here is the opposite. He always lies expecting people to be good and always goes for the kill.
+class Lucifer (BaseAgent):
+       def Attack (self, foe):
+               attack = RandomAttack ()
+               if attack == Rock: bluff = Scissors     # Here we choose the thing
+               elif attack == Paper: bluff = Rock      # that will hurt them
+               else: bluff = Paper                     # if they go for a tie.
+               return attack, bluff
+       def Defend (self, foe, bluff):
+               if bluff == Rock: attack = Paper        # Here we trust that they
+               elif bluff == Paper: attack = Scissors  # are telling the truth.
+               else: attack = Rock                     # And we try to kill them.
+               return attack
+#      def Results (self, foeName, wasAttacker, winner, attItem, defItem, bluffItem, pointDelta):
+#              BaseAgent.Results (self, foeName, wasAttacker, winner, attItem, defItem, bluffItem, pointDelta)
+#              print "I just scored " + str(pointDelta) + " points!"
+
+
+# Streetfighter assumes everyone has it in for him.
+class Streetfighter (BaseAgent):
+       def Attack (self, foe):
+               attack = RandomAttack ()
+               if attack == Rock: bluff = Paper        # Here we choose the thing
+               elif attack == Paper: bluff = Scissors  # that will hurt them
+               else: bluff = Rock                      # if they try to kill us.
+               return attack, bluff
+       def Defend (self, foe, bluff):
+               if bluff == Rock: attack = Scissors     # Here we assume that they
+               elif bluff == Paper: attack = Rock      # are lying, trying to kill us.
+               else: attack = Paper                    # And we try to kill them.
+               return attack
+
+# 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):
+       def Attack (self, foe):
+               attack = RandomAttack ()
+               if Loss in LearningAgent.GetWinHistory (self, foe):
+                       if attack == Rock: bluff = Scissors
+                       elif attack == Paper: bluff = Rock
+                       else: bluff = Paper
+               else:
+                       bluff = attack
+               return attack, bluff
+       def Defend (self, foe, bluff):
+               if Loss in LearningAgent.GetWinHistory (self, foe):
+                       if bluff == Rock: attack = Scissors     # They've fucked us in the past,
+                       elif bluff == Paper: attack = Rock      # so we assume they're lying and
+                       else: attack = Paper                    # hoping we go for a kill.
+               else:
+                       attack = bluff
+               return attack
+
+
+# If you want to implement your own Results () callback, you have to call the parent class's first:
+class Blank (BaseAgent):
+       def Attack (self, foe):
+               return Paper, Paper
+       def Defend (self, foe, bluff):
+               return bluff
+       def Results (self, foeName, wasAttacker, winner, attItem, defItem, bluffItem, pointDelta):
+               BaseAgent.Results (self, foeName, wasAttacker, winner, attItem, defItem, bluffItem, pointDelta)
+               # Now you can do your own thing
+
diff --git a/rps/trunk/SampleAgents.py.old b/rps/trunk/SampleAgents.py.old
new file mode 100644 (file)
index 0000000..d307214
--- /dev/null
@@ -0,0 +1,89 @@
+'''SampleAgents.py - A collection of sample agents for playing Rock Paper Scissors.
+Written by Luke Williams <[email protected]> for the UCC Programming Competition in 2008.
+Requires Python 2.5.
+
+Licensed under an MIT-style license: see the LICENSE file for details.
+'''
+
+from uccProgComp import BaseAgent, LearningAgent, RandomAttack
+from rpsconst import *
+
+# Angel is a very simple bot that always tells the truth and expects others to do the same.
+class Dummy (BaseAgent):
+       def Attack (self, foe):
+               return Paper, Paper
+       def Defend (self, foe, bluff):
+               return bluff
+
+class Angel (BaseAgent):
+       def Attack (self, foe):
+               attack = RandomAttack ()        # Chooses randomly from Rock, Paper, Scissors
+               return attack, attack           # Tells the truth for its bluff.
+       def Defend (self, foe, bluff):
+               return bluff                    # Trusts them to be going for a tie.
+
+# Lucifer here is the opposite. He always lies expecting people to be good and always goes for the kill.
+class Lucifer (BaseAgent):
+       def Attack (self, foe):
+               attack = RandomAttack ()
+               if attack == Rock: bluff = Scissors     # Here we choose the thing
+               elif attack == Paper: bluff = Rock      # that will hurt them
+               else: bluff = Paper                     # if they go for a tie.
+               return attack, bluff
+       def Defend (self, foe, bluff):
+               if bluff == Rock: attack = Paper        # Here we trust that they
+               elif bluff == Paper: attack = Scissors  # are telling the truth.
+               else: attack = Rock                     # And we try to kill them.
+               return attack
+#      def Results (self, foeName, wasAttacker, winner, attItem, defItem, bluffItem, pointDelta):
+#              BaseAgent.Results (self, foeName, wasAttacker, winner, attItem, defItem, bluffItem, pointDelta)
+#              print "I just scored " + str(pointDelta) + " points!"
+
+
+# Streetfighter assumes everyone has it in for him.
+class Streetfighter (BaseAgent):
+       def Attack (self, foe):
+               attack = RandomAttack ()
+               if attack == Rock: bluff = Paper        # Here we choose the thing
+               elif attack == Paper: bluff = Scissors  # that will hurt them
+               else: bluff = Rock                      # if they go for a tie.
+               return attack, bluff
+       def Defend (self, foe, bluff):
+               if bluff == Rock: attack = Paper        # Here we trust that they
+               elif bluff == Paper: attack = Scissors  # are telling the truth.
+               else: attack = Rock                     # And we try to kill them.
+               return attack
+
+# 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):
+       def Attack (self, foe):
+               attack = RandomAttack ()
+               if Loss in LearningAgent.GetWinHistory (self, foe):
+                       if attack == Rock: bluff = Scissors
+                       elif attack == Paper: bluff = Rock
+                       else: bluff = Paper
+               else:
+                       bluff = attack
+               return attack, bluff
+       def Defend (self, foe, bluff):
+               if Loss in LearningAgent.GetWinHistory (self, foe):
+                       if bluff == Rock: attack = Scissors     # They've fucked us in the past,
+                       elif bluff == Paper: attack = Rock      # so we assume they're lying and
+                       else: attack = Paper                    # hoping we go for a kill.
+               else:
+                       attack = bluff
+               return attack
+
+
+# If you want to implement your own Results () callback, you have to call the parent class's first:
+class Blank (BaseAgent):
+       def Attack (self, foe):
+               return Paper, Paper
+       def Defend (self, foe, bluff):
+               return bluff
+       def Results (self, foeName, wasAttacker, winner, attItem, defItem, bluffItem, pointDelta):
+               BaseAgent.Results (self, foeName, wasAttacker, winner, attItem, defItem, bluffItem, pointDelta)
+               # Now you can do your own thing
+
diff --git a/rps/trunk/SampleAgents.pyc b/rps/trunk/SampleAgents.pyc
new file mode 100644 (file)
index 0000000..7b91932
Binary files /dev/null and b/rps/trunk/SampleAgents.pyc differ
diff --git a/rps/trunk/djaAgents.py b/rps/trunk/djaAgents.py
new file mode 100644 (file)
index 0000000..6912c7f
--- /dev/null
@@ -0,0 +1,77 @@
+from uccProgComp import BaseAgent, LearningAgent, RandomAttack
+from rpsconst import *
+
+# BOFH is something of a cross between Frechie and Lucifer
+
+class BOFH (LearningAgent):
+       def Attack (self, foe):
+               attack = RandomAttack ()
+               
+               return attack, bluff
+       def Defend (self, foe, bluff):
+               if bluff == Rock: attack = Scissors     # Here we assume that they
+               elif bluff == Paper: attack = Rock      # are lying, trying to kill us.
+               else: attack = Paper                    # And we try to kill them.
+               return attack
+
+       def Attack (self, foe):
+               attack = RandomAttack ()
+               if len(LearningAgent.GetWinHistory (self, foe)) > 0:
+                       if attack == Rock: bluff = Paper        # Here we choose the thing
+                       elif attack == Paper: bluff = Scissors  # that will hurt them
+                       else: bluff = Rock                      # if they try to kill us.
+               else:
+                       if attack == Rock: bluff = Scissors     # Here we choose the thing
+                       elif attack == Paper: bluff = Rock      # that will hurt them
+                       else: bluff = Paper                     # if they go for a tie.
+               return attack, bluff
+               
+       def Defend (self, foe, bluff):
+               if len(LearningAgent.GetWinHistory (self, foe)) > 0:
+                       if bluff == Rock: attack = Scissors     # They've fucked us in the past,
+                       elif bluff == Paper: attack = Rock      # so we assume they're lying and
+                       else: attack = Paper                    # hoping we go for a kill.
+               else:
+                       if bluff == Rock: attack = Paper        # Here we trust that they
+                       elif bluff == Paper: attack = Scissors  # are telling the truth.
+                       else: attack = Rock                     # And we try to kill them.
+               return attack
+
+#Fish is somewhat intelligent; it builds up trust and then stabs you in the back.
+# If Fish detects that a bot is being predictably nice (tie 2+ times in a row), it will attack.
+# If Fish detects that a bot has betrayed it (Loss), it will attack.
+# Otherwise, Fish is nice.
+
+class Fish (LearningAgent):
+       def Attack (self, foe):
+               #print "Attacking" , foe
+               #print LearningAgent.GetWinHistory (self, foe)
+               attack = RandomAttack ()
+               
+               history = LearningAgent.GetWinHistory (self, foe)
+               
+               #no history; be nice
+               if len(history) == 0:
+                       bluff = attack
+               
+               #if we just lost to them, try to destroy them.
+               elif Loss == history[-1] or (len(history)>1 and [Tie,Tie] == history[-2:-1]):
+                       if attack == Rock: bluff = Scissors
+                       elif attack == Paper: bluff = Rock
+                       else: bluff = Paper
+               else:
+                       bluff = attack
+               return attack, bluff
+               
+               
+       def Defend (self, foe, bluff):
+               
+               history = LearningAgent.GetWinHistory (self, foe)
+               
+               if len(history) > 0 and Loss == history[-1]:
+                       if bluff == Rock: attack = Scissors     # They've fucked us in the past,
+                       elif bluff == Paper: attack = Rock      # so we assume they're lying and
+                       else: attack = Paper                    # hoping we go for a kill.
+               else:
+                       attack = bluff
+               return attack
\ No newline at end of file
diff --git a/rps/trunk/djaAgents.pyc b/rps/trunk/djaAgents.pyc
new file mode 100644 (file)
index 0000000..9d72619
Binary files /dev/null and b/rps/trunk/djaAgents.pyc differ
diff --git a/rps/trunk/rpsconst.py b/rps/trunk/rpsconst.py
new file mode 100644 (file)
index 0000000..5bf1ea5
--- /dev/null
@@ -0,0 +1,19 @@
+'''rpsconst.py - A precarious collection of constants for RPS simulation.
+Written by Luke Williams <[email protected]> for the UCC Programming Competition in 2008.
+
+Licensed under an MIT-style license: see the LICENSE file for details.
+'''
+
+Rock = 0
+Paper = 1
+Scissors = 2
+Attacker = 0
+Defender = 1
+Tie = 2
+Bluff = 0
+Truth = 1
+Win = 3
+Loss = 4
+# EOF. Stop reading now, kid, you'll only hurt yourself.
+resultTable = [[Tie,Defender,Attacker],[Attacker,Tie,Defender],[Defender, Attacker, Tie]]
+pointsTable = [[0,0],[0,0],[0,0]]
diff --git a/rps/trunk/rpsconst.pyc b/rps/trunk/rpsconst.pyc
new file mode 100644 (file)
index 0000000..6feecaf
Binary files /dev/null and b/rps/trunk/rpsconst.pyc differ
diff --git a/rps/trunk/selectAlgorithms.py b/rps/trunk/selectAlgorithms.py
new file mode 100644 (file)
index 0000000..41be346
--- /dev/null
@@ -0,0 +1,23 @@
+# Alternative (obsolete) algorithms for selecting agents for battle.
+# They're all a bit crap and only here for comparison purposes.
+
+
+# Selects an opponent and removes it from the list of remaining potential opponents.
+       # This is just an example, but the fact that the first agent will miss out on having
+       # a fight picked with it it, and that the last agent won't get to pick a fight, seems
+       # to not matter very much. Can probably be left as-is.
+       def ChoosePair (self):
+               # This approach forces each agent to defend once and attack once per round.
+               # Keep track of the remaining population.
+               remaining = self.population[:]
+               agentID = random.randint (0,len(remaining)-1)
+               defender = remaining.pop (agentID) # Not really a defender (try to work it out)!
+               while len (remaining) > 1:
+                       if defender.GetPoints () < 1:   # If the agent died before it got a chance to attack
+                               attackerID = random.randint (0,len(remaining)-1)
+                               attacker = remaining.pop (attackerID)
+                       else: attacker = defender
+                       defenderID = random.randint (0,len(remaining)-1)
+                       defender = remaining.pop (defenderID)
+                       yield attacker, defender
+
diff --git a/rps/trunk/simulate.py b/rps/trunk/simulate.py
new file mode 100755 (executable)
index 0000000..13a20fa
--- /dev/null
@@ -0,0 +1,86 @@
+#!/usr/bin/python2.5
+'''simulate.py - Runs a full simulation of the UCC Programming Competition with the provided agents.
+Written by Luke Williams <[email protected]> for the UCC Programming Competition in 2008.
+
+Licensed under an MIT-style license: see the LICENSE file for details.
+'''
+
+# Import and add your agents here:
+from djaAgents import BOFH
+from SampleAgents import Angel, Lucifer, Dummy, Frenchie, Streetfighter
+Agents = [Angel, Lucifer, Frenchie, Streetfighter, BOFH]
+
+####################################
+# Developers only past this point! #
+####################################
+
+import sys
+from uccProgComp import Supervisor
+
+maxIterations = 150
+startingPopulations = 10
+verbose = False
+trials = 1
+usage = "Usage: rps [-v] [-i iterations=150] [-n starting_populations=10] [-t trials=1]"
+for i in range (1,len(sys.argv)):
+       if sys.argv[i] == "-i":
+               try:
+                       maxIterations = int(sys.argv[i+1])
+                       i += 1
+                       continue
+               except:
+                       print usage
+                       sys.exit(1)
+       elif sys.argv[i] == "-n":
+               try:
+                       startingPopulations = int(sys.argv[i+1])
+                       i += 1
+                       continue
+               except:
+                       print usage
+                       sys.exit(1)
+       elif sys.argv[i] == "-t":
+               try:
+                       trials = int(sys.argv[i+1])
+                       i += 1
+                       continue
+               except:
+                       print usage
+                       sys.exit(1)
+
+       elif sys.argv[i] == "-v":
+               verbose = True
+
+
+iteration = 0
+trial = 0
+winners = {}
+while trial < trials:
+       sup = Supervisor ()
+       for Agent in Agents: sup.RegisterAgent (Agent)
+       sup.GeneratePopulation (startingPopulations)
+
+       trial += 1
+       iteration = 0
+       while iteration < maxIterations and not sup.IsGameOver ():
+               iteration += 1
+               sup.Iterate ()
+               if not verbose: continue
+               print "Iteration %d:" % iteration
+               for key, value in sup.GetStats ().iteritems():
+                       print "%s: Population=%d, Newborns=%d, Deaths=%d" % (key, value[0], value[1], value[2])
+       winner = ("Error", -1)
+       for key, value in sup.GetStats ().iteritems ():
+               #print key, value
+               if value[0] > winner[1]:
+                       winner = (key, value[0])
+       if winner[0] in winners: winners[winner[0]] += 1
+       else: winners[winner[0]] = 1
+       #print "Winner: %s" % winner[0]
+
+print "SCOREBOARD OVER %d TRIALS OF %d ROUNDS EACH" % (trials, maxIterations)
+rawscoreboard = sorted ( [(score,player) for (player,score) in winners.items ()] , reverse=True )
+scoreboard = []
+for score, player in rawscoreboard:
+       print "%s: %s" % (player, score)
+
diff --git a/rps/trunk/uccProgComp.py b/rps/trunk/uccProgComp.py
new file mode 100644 (file)
index 0000000..0eee563
--- /dev/null
@@ -0,0 +1,211 @@
+'''uccProgComp.py - A supervisor candidate for Rock Paper Scissors.
+Written by Luke Williams <[email protected]> for the UCC Programming Competition in 2008.
+Requires Python 2.5.
+
+Licensed under an MIT-style license: see the LICENSE file for details.
+'''
+
+
+import random, uuid
+random.seed ()
+
+from rpsconst import *
+
+DEFAULT_HEALTH = 50
+REPRODUCE_HEALTH = 100
+DIE_HEALTH = 0
+MAX_AGE = 100
+
+DEBUG_MODE = False
+
+# Game dynamics - these are not final:
+#               WINNER          TRUTH          ATTPoints, DEFPoints
+pointsTable    [Attacker]      [False] =       (2, -2)
+pointsTable    [Attacker]      [True]  =       (2, -2)
+pointsTable    [Defender]      [False] =       (-2, 2)
+pointsTable    [Defender]      [True]  =       (-2, 2)
+pointsTable    [Tie]           [False] =       (0, 0)
+pointsTable    [Tie]           [True]  =       (1, 1)
+
+def Debug (f):
+       def g (*args):
+               if DEBUG_MODE:
+                       print f.__name__, args[1].__class__.__name__, args[1].GetID ()
+               return f (*args)
+       return g
+
+class BaseAgent:
+       def __init__ (self):
+               self.id = uuid.uuid4().int
+               self.__points = DEFAULT_HEALTH
+               # The index will be changing all the time. It can go stale as soon as something dies.
+               # So use it cautiously.
+               self.__currentIndex = 0
+               self.__reproduced = False
+               self.__age = 0
+
+       def GetCurrentIndex (self):
+               return self.__currentIndex
+       
+       def SetCurrentIndex (self, index):
+               self.__currentIndex = index
+
+       def GetID (self):
+               return self.id
+       
+       def GetPoints (self):
+               return self.__points
+
+       def SetPoints (self, points):
+               self.__points = points
+
+       def Defend (self, foe, bluff):
+               return Rock
+       
+       def Attack (self, foe):
+               return Rock
+
+       def IsDead (self):
+               return self.__points <= DIE_HEALTH
+
+       def Reproduced (self):
+               self.__points = DEFAULT_HEALTH
+               self.__reproduced = True
+
+       def HasReproduced (self):
+               return self.__reproduced
+
+       def SetReproduced (self, repro):
+               self.__reproduced = repro
+
+       def Results (self, foeName, wasAttacker, winner, attItem, defItem, bluffItem, pointDelta):
+               self.__points += pointDelta
+               self.__age += 1
+               if self.__age > MAX_AGE: self.__points = DIE_HEALTH
+
+class LearningAgent (BaseAgent):
+       def __init__ (self):
+               BaseAgent.__init__ (self)
+               self.winHistory = {}
+       
+       def Results (self, foeName, wasAttacker, winner, attItem, defItem, bluffItem, pointDelta):
+               BaseAgent.Results (self, foeName, wasAttacker, winner, attItem, defItem, bluffItem, pointDelta)
+               if wasAttacker:
+                       if winner == Attacker: result = Win
+                       elif winner == Tie: result = Tie
+                       else: result = Loss
+               else:
+                       if winner == Attacker: result = Loss
+                       elif winner == Tie: result = Tie
+                       else: result = Win
+                       
+               if foeName in self.winHistory: self.winHistory [foeName].append (result)
+               else: self.winHistory [foeName] = [result]
+
+       def GetWinHistory (self, foeName):
+               if foeName in self.winHistory: return self.winHistory [foeName]
+               else: return []
+
+class Supervisor:
+       def __init__ (self):
+               # The full list of living agents
+               self.population = []
+               # A list of classes for each agent type
+               self.agentTypes = []
+               # The current iteration
+               self.iteration = 0
+               self.agentStats = {}
+               self.pendingDeaths = []
+
+       def RegisterAgent (self, agent):
+               self.agentTypes.append (agent)
+
+       def GeneratePopulation (self, nAgentsPerClass):
+               for Agent in self.agentTypes:
+                       for i in range (0,nAgentsPerClass): self.population.append (Agent ())
+                       self.agentStats [str(Agent)] = [nAgentsPerClass,0,0]
+
+       def Iterate (self):
+               self.ClearStats ()
+               self.UpdateIndexes ()
+               self.iteration += 1
+               for attacker, defender in self.Select ():
+                       attack, bluff = attacker.Attack (defender.GetID ())
+                       defense = defender.Defend (attacker.GetID (), bluff)
+                       winner = resultTable [attack] [defense]
+                       attPoints, defPoints = pointsTable [winner][attack == bluff]
+                       attacker.Results (defender.GetID (), True, winner, attack, defense, bluff, attPoints)
+                       defender.Results (attacker.GetID (), False, winner, attack, defense, bluff, defPoints)
+                       if attacker.IsDead (): self.KillAgent (attacker)
+                       elif attacker.GetPoints () >= REPRODUCE_HEALTH: self.SpawnAgent (attacker)
+                       if defender.IsDead (): self.KillAgent (defender)
+                       elif defender.GetPoints () >= REPRODUCE_HEALTH: self.SpawnAgent (defender)
+
+       def IsGameOver (self):
+               if self.population == []: return True
+               liveAgents = [id for id,stats in self.agentStats.iteritems () if stats[0] > 0]
+               print liveAgents
+               if len(liveAgents) < 2: return True
+               return False
+       
+       # This is needed because when we pick the players we also need a way of identifying them in the
+       # population list without manually searching each time. O(n) each iteration is better than O(n)
+       # each death. It also resets the check for if the agent has reproduced this round.
+       def UpdateIndexes (self):
+               for agentID in reversed(sorted(self.pendingDeaths)): del self.population [agentID]
+               for index, agent in enumerate(self.population): 
+                       agent.SetCurrentIndex (index)
+                       agent.SetReproduced (False)
+               self.pendingDeaths = []
+
+       @Debug
+       def KillAgent (self, agent):
+               self.pendingDeaths.append (agent.GetCurrentIndex ())
+               stat = self.agentStats [str(agent.__class__)]
+               stat [0] -= 1
+               stat [2] += 1
+
+       @Debug
+       def SpawnAgent (self, agent):
+               child = agent.__class__ ()
+               self.population.append (child)
+               agent.Reproduced ()
+               stat = self.agentStats [str(agent.__class__)]
+               stat [0] += 1
+               stat [1] += 1 
+
+       def Select (self):
+               # This approach causes agents to keep fighting until they've either died or reproduced.
+               remaining = self.population[:]
+               attackerID = defenderID = random.randint (0,len(remaining)-1)
+               attacker = defender = remaining [attackerID]
+               while len (remaining) >= 2:
+                       # Check to see if the attacker from last round needs to be dropped.
+                       if attacker.IsDead () or attacker.HasReproduced ():
+                               remaining.pop (attackerID)
+                               if not len(remaining) >= 2: continue
+                               if defenderID > attackerID: defenderID -= 1
+                       # Check to see if the defender from last round is up for some attacking.
+                       if defender.IsDead () or defender.HasReproduced ():
+                               remaining.pop (defenderID)
+                               if not len(remaining) >= 2: continue
+                               attackerID = random.randint (0,len(remaining)-1)
+                               attacker = remaining [attackerID]
+                       else:
+                               attacker = defender
+                               attackerID = defenderID
+                       defender = None
+                       defenderID = random.randint (0,len(remaining)-2)
+                       if defenderID >= attackerID: defenderID += 1
+                       defender = remaining [defenderID]
+
+                       yield attacker, defender
+
+       def GetStats (self):
+               return self.agentStats
+
+       def ClearStats (self):
+               for agent in self.agentTypes: self.agentStats [str(agent)] = self.agentStats [str(agent)] [:1] + [0,0]
+
+def RandomAttack ():
+       return random.randint (0,2)
diff --git a/rps/trunk/uccProgComp.py.old b/rps/trunk/uccProgComp.py.old
new file mode 100644 (file)
index 0000000..17ffa2a
--- /dev/null
@@ -0,0 +1,211 @@
+'''uccProgComp.py - A supervisor candidate for Rock Paper Scissors.
+Written by Luke Williams <[email protected]> for the UCC Programming Competition in 2008.
+Requires Python 2.5.
+
+Licensed under an MIT-style license: see the LICENSE file for details.
+'''
+
+
+import random, uuid
+random.seed ()
+
+from rpsconst import *
+
+DEFAULT_HEALTH = 50
+REPRODUCE_HEALTH = 100
+DIE_HEALTH = 0
+MAX_AGE = 100
+
+DEBUG_MODE = False
+
+# Game dynamics - these are not final:
+#               WINNER          TRUTH          WINNER, LOSER
+pointsTable    [Attacker]      [False] =       (2, -2)
+pointsTable    [Attacker]      [True]  =       (2, -2)
+pointsTable    [Defender]      [False] =       (-2, 2)
+pointsTable    [Defender]      [True]  =       (-2, 2)
+pointsTable    [Tie]           [False] =       (-1, -1)
+pointsTable    [Tie]           [True]  =       (1, 1)
+
+def Debug (f):
+       def g (*args):
+               if DEBUG_MODE:
+                       print f.__name__, args[1].__class__.__name__, args[1].GetID ()
+               return f (*args)
+       return g
+
+class BaseAgent:
+       def __init__ (self):
+               self.id = uuid.uuid4().int
+               self.__points = DEFAULT_HEALTH
+               # The index will be changing all the time. It can go stale as soon as something dies.
+               # So use it cautiously.
+               self.__currentIndex = 0
+               self.__reproduced = False
+               self.__age = 0
+
+       def GetCurrentIndex (self):
+               return self.__currentIndex
+       
+       def SetCurrentIndex (self, index):
+               self.__currentIndex = index
+
+       def GetID (self):
+               return self.id
+       
+       def GetPoints (self):
+               return self.__points
+
+       def SetPoints (self, points):
+               self.__points = points
+
+       def Defend (self, foe, bluff):
+               return Rock
+       
+       def Attack (self, foe):
+               return Rock
+
+       def IsDead (self):
+               return self.__points <= DIE_HEALTH
+
+       def Reproduced (self):
+               self.__points = DEFAULT_HEALTH
+               self.__reproduced = True
+
+       def HasReproduced (self):
+               return self.__reproduced
+
+       def SetReproduced (self, repro):
+               self.__reproduced = repro
+
+       def Results (self, foeName, wasAttacker, winner, attItem, defItem, bluffItem, pointDelta):
+               self.__points += pointDelta
+               self.__age += 1
+               if self.__age > MAX_AGE: self.__points = DIE_HEALTH
+
+class LearningAgent (BaseAgent):
+       def __init__ (self):
+               BaseAgent.__init__ (self)
+               self.winHistory = {}
+       
+       def Results (self, foeName, wasAttacker, winner, attItem, defItem, bluffItem, pointDelta):
+               BaseAgent.Results (self, foeName, wasAttacker, winner, attItem, defItem, bluffItem, pointDelta)
+               if wasAttacker:
+                       if winner == Attacker: result = Win
+                       elif winner == Tie: result = Tie
+                       else: result = Loss
+               else:
+                       if winner == Attacker: result = Loss
+                       elif winner == Tie: result = Tie
+                       else: result = Win
+                       
+               if foeName in self.winHistory: self.winHistory [foeName].append (result)
+               else: self.winHistory [foeName] = [result]
+
+       def GetWinHistory (self, foeName):
+               if foeName in self.winHistory: return self.winHistory [foeName]
+               else: return []
+
+class Supervisor:
+       def __init__ (self):
+               # The full list of living agents
+               self.population = []
+               # A list of classes for each agent type
+               self.agentTypes = []
+               # The current iteration
+               self.iteration = 0
+               self.agentStats = {}
+               self.pendingDeaths = []
+
+       def RegisterAgent (self, agent):
+               self.agentTypes.append (agent)
+
+       def GeneratePopulation (self, nAgentsPerClass):
+               for Agent in self.agentTypes:
+                       for i in range (0,nAgentsPerClass): self.population.append (Agent ())
+                       self.agentStats [str(Agent)] = [nAgentsPerClass,0,0]
+
+       def Iterate (self):
+               self.ClearStats ()
+               self.UpdateIndexes ()
+               self.iteration += 1
+               for attacker, defender in self.Select ():
+                       attack, bluff = attacker.Attack (defender.GetID ())
+                       defense = defender.Defend (attacker.GetID (), bluff)
+                       winner = resultTable [attack] [defense]
+                       attPoints, defPoints = pointsTable [winner][attack == bluff]
+                       attacker.Results (defender.GetID (), True, winner, attack, defense, bluff, attPoints)
+                       defender.Results (attacker.GetID (), False, winner, attack, defense, bluff, defPoints)
+                       if attacker.IsDead (): self.KillAgent (attacker)
+                       elif attacker.GetPoints () >= REPRODUCE_HEALTH: self.SpawnAgent (attacker)
+                       if defender.IsDead (): self.KillAgent (defender)
+                       elif defender.GetPoints () >= REPRODUCE_HEALTH: self.SpawnAgent (defender)
+
+       def IsGameOver (self):
+               if self.population == []: return True
+               liveAgents = [id for id,stats in self.agentStats.iteritems () if stats[0] > 0]
+               print liveAgents
+               if len(liveAgents) < 2: return True
+               return False
+       
+       # This is needed because when we pick the players we also need a way of identifying them in the
+       # population list without manually searching each time. O(n) each iteration is better than O(n)
+       # each death. It also resets the check for if the agent has reproduced this round.
+       def UpdateIndexes (self):
+               for agentID in reversed(sorted(self.pendingDeaths)): del self.population [agentID]
+               for index, agent in enumerate(self.population): 
+                       agent.SetCurrentIndex (index)
+                       agent.SetReproduced (False)
+               self.pendingDeaths = []
+
+       @Debug
+       def KillAgent (self, agent):
+               self.pendingDeaths.append (agent.GetCurrentIndex ())
+               stat = self.agentStats [str(agent.__class__)]
+               stat [0] -= 1
+               stat [2] += 1
+
+       @Debug
+       def SpawnAgent (self, agent):
+               child = agent.__class__ ()
+               self.population.append (child)
+               agent.Reproduced ()
+               stat = self.agentStats [str(agent.__class__)]
+               stat [0] += 1
+               stat [1] += 1 
+
+       def Select (self):
+               # This approach causes agents to keep fighting until they've either died or reproduced.
+               remaining = self.population[:]
+               attackerID = defenderID = random.randint (0,len(remaining)-1)
+               attacker = defender = remaining [attackerID]
+               while len (remaining) >= 2:
+                       # Check to see if the attacker from last round needs to be dropped.
+                       if attacker.IsDead () or attacker.HasReproduced ():
+                               remaining.pop (attackerID)
+                               if not len(remaining) >= 2: continue
+                               if defenderID > attackerID: defenderID -= 1
+                       # Check to see if the defender from last round is up for some attacking.
+                       if defender.IsDead () or defender.HasReproduced ():
+                               remaining.pop (defenderID)
+                               if not len(remaining) >= 2: continue
+                               attackerID = random.randint (0,len(remaining)-1)
+                               attacker = remaining [attackerID]
+                       else:
+                               attacker = defender
+                               attackerID = defenderID
+                       defender = None
+                       defenderID = random.randint (0,len(remaining)-2)
+                       if defenderID >= attackerID: defenderID += 1
+                       defender = remaining [defenderID]
+
+                       yield attacker, defender
+
+       def GetStats (self):
+               return self.agentStats
+
+       def ClearStats (self):
+               for agent in self.agentTypes: self.agentStats [str(agent)] = self.agentStats [str(agent)] [:1] + [0,0]
+
+def RandomAttack ():
+       return random.randint (0,2)
diff --git a/rps/trunk/uccProgComp.pyc b/rps/trunk/uccProgComp.pyc
new file mode 100644 (file)
index 0000000..77283f4
Binary files /dev/null and b/rps/trunk/uccProgComp.pyc differ
diff --git a/technicalities.txt b/technicalities.txt
new file mode 100644 (file)
index 0000000..2f75cd8
--- /dev/null
@@ -0,0 +1,53 @@
+Points Table:
+
+ACTION         RESULT  YOUR POINTS     THEIR POINTS
+Tell the truth Win     +2              -3
+Tell the truth Lose    -3              +4
+Tell the truth Tie     +3              +3
+Lie            Win     +4              -5
+Lie            Lose    -3              +3
+Lie            Tie     0               0
+
+Python Agents:
+
+Your agent class should at the very least provide the following:
+class <AgentName>:
+       points = 0      # Will be kept updated by the supervisor. No point modifying it.
+       children = 0    # Will also be kept updated by the supervisor.
+       state = {}      # You needn't actually keep state, and it certainly doesn't have to be a dictionary.
+       def Defend (self, foeName, foePromisedAttack):  # foeName and foePromisedAttack are both strings.
+               return "Rock"                           # Not a very good idea, but this is the format you need to use.
+       def Attack (self, foeName):                             # Also note that the supervisor doesn't use named arguments.
+               return "Rock", "Paper"                  # Real first, then promised. Won't they be surprised!
+       def Results (self, foeName, isInstigatedByYou, yourItem, theirItem, promisedItem):      # The second argument is a boolean.
+               pass                                    # You probably want to store at least some of this information.
+       
+Other Agents:
+
+The syntax for input and output is as follows. Every line of input given by the supervisor must be replied with the correct response.
+Segmentation fault is never the correct response :-). Rumour has it that if you just use Python, this won't happen. 
+
+The angle brackets (<>) indicate whether the line is output from the agent or input to it respectively, and are not part of the actual formatting.
+
+Syntax for an attacking agent:
+>ATTACK foeName
+<ATTACKING itemToUse itemToPromise
+Example:
+>ATTACK agent00002
+<ATTACKING Paper Scissors
+
+Syntax for a defending agent:
+>DEFEND foeName foePromisedItem
+<DEFENDING itemUsed
+Example:
+>DEFEND agent00001 Scissors
+<DEFENDING Rock
+
+Syntax for collecting results:
+>RESULTS foeName didYouInstigate yourItem theirItem promisedItem pointChange childSpawned
+<OK
+Example:
+>RESULTS agent00001 False Rock Paper Scissors -2 False
+<You fucking traitor.
+
+In the last example, the correct response would actually have been 'OK', but agent00002 can get a bit emotional sometimes. Try to avoid that in your agents.

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