From 1740df9314f3dc49c6d44378c5915674aa1ab75f Mon Sep 17 00:00:00 2001 From: Daniel Axtens Date: Wed, 21 Apr 2010 16:01:08 +0800 Subject: [PATCH] c-link written --- .gitignore | 1 + link/C/Link/c-link-lib/Makefile | 14 -------- link/C/Link/c-link-lib/link.o | Bin 572 -> 0 bytes link/C/c-link-lib/.gitignore | 2 ++ link/C/c-link-lib/Makefile | 30 ++++++++++++++++++ .../agents}/c-angel.c | 2 +- .../agents}/c-lucifer.c | 2 +- .../agents}/c-streetfighter.c | 2 +- .../c-link-lib.xcodeproj/project.pbxproj | 28 ++++++++-------- .../c-link.c => c-link-lib/c_link.c} | 12 +++---- .../c-link.h => c-link-lib/c_link.h} | 2 +- 11 files changed, 56 insertions(+), 39 deletions(-) delete mode 100644 link/C/Link/c-link-lib/Makefile delete mode 100644 link/C/Link/c-link-lib/link.o create mode 100644 link/C/c-link-lib/.gitignore create mode 100644 link/C/c-link-lib/Makefile rename link/C/{Link/c-link-lib/sample-agents => c-link-lib/agents}/c-angel.c (97%) rename link/C/{Link/c-link-lib/sample-agents => c-link-lib/agents}/c-lucifer.c (98%) rename link/C/{Link/c-link-lib/sample-agents => c-link-lib/agents}/c-streetfighter.c (98%) rename link/C/{Link => }/c-link-lib/c-link-lib.xcodeproj/project.pbxproj (76%) rename link/C/{Link/c-link-lib/c-link.c => c-link-lib/c_link.c} (86%) rename link/C/{Link/c-link-lib/c-link.h => c-link-lib/c_link.h} (96%) diff --git a/.gitignore b/.gitignore index c2668d6..483ef52 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ build/ *.mode1v3 *.o +*.a # old skool .svn diff --git a/link/C/Link/c-link-lib/Makefile b/link/C/Link/c-link-lib/Makefile deleted file mode 100644 index 86d085d..0000000 --- a/link/C/Link/c-link-lib/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -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/link.o b/link/C/Link/c-link-lib/link.o deleted file mode 100644 index facc4cbba13488a2d6c7da16c6659be5cbea9817..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 572 zcmX^A>+L^w1_nlE1|R{%AUXiVPyk{ekOblvU>0^F0V-So(gOquV3L6WXeJmlLHY6V zC8-r9P!5oaj}LK;2tn{+EFmZZW*$tOfrX&~&IU5#<5M%@(~1&vQz4@0=1D*mdqC+9 zp!-06y8xtFfHXG)Lk3g|Oo7}9((?hTP5~$&1LOnMF$4fH2!Ol@!XULEv&aFV9-U7+ zYyWt3mVVd)(tq+W#1s*zVT@Hl42%^5i~>CD920<+=>Ww+?)~u}0$}08zyfj!pFkTE z3&<(FY(N486o44$zBmvKRKW-G0}#Z3XrMTc0FdSbGGO5YGKC*RKmjP;_<`~UFoF2o V#LPSfFsYZC!Qkov33WrDJOEQ=Gm!uQ diff --git a/link/C/c-link-lib/.gitignore b/link/C/c-link-lib/.gitignore new file mode 100644 index 0000000..fbde527 --- /dev/null +++ b/link/C/c-link-lib/.gitignore @@ -0,0 +1,2 @@ +agents/ +!agents/*.c diff --git a/link/C/c-link-lib/Makefile b/link/C/c-link-lib/Makefile new file mode 100644 index 0000000..c10ef62 --- /dev/null +++ b/link/C/c-link-lib/Makefile @@ -0,0 +1,30 @@ +CC=gcc +AR=ar + +CFLAGS=-Wall -I. +LDFLAGS=-lc_link -L. + +LINKSRCS=c_link.c +LINKOBJS=$(LINKSRCS:.c=.o) +LINKLIB=libc_link.a + +AGENTSRCS=$(wildcard agents/*.c) +AGENTS=$(AGENTSRCS:.c=) + +EXECUTABLE=rps-c + +all: $(LINKSRCS) $(LINKLIB) $(AGENTS) + +$(LINKLIB): $(LINKOBJS) + $(AR) rcs $(LINKLIB) $(LINKOBJS) + +$(AGENTS): $(AGENTSRCS) + @echo Building $< + $(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ + +.c.o: c_link.h + $(CC) -c $(CFLAGS) $< -o $@ + +.PHONY : clean +clean: + rm $(LINKOBJS) $(LINKLIB) $(AGENTS) \ No newline at end of file diff --git a/link/C/Link/c-link-lib/sample-agents/c-angel.c b/link/C/c-link-lib/agents/c-angel.c similarity index 97% rename from link/C/Link/c-link-lib/sample-agents/c-angel.c rename to link/C/c-link-lib/agents/c-angel.c index 1efaa80..c628ade 100644 --- a/link/C/Link/c-link-lib/sample-agents/c-angel.c +++ b/link/C/c-link-lib/agents/c-angel.c @@ -7,7 +7,7 @@ * */ -#include +#include /* Implement the angel bot, which always tells the truth and expects others to do the same */ diff --git a/link/C/Link/c-link-lib/sample-agents/c-lucifer.c b/link/C/c-link-lib/agents/c-lucifer.c similarity index 98% rename from link/C/Link/c-link-lib/sample-agents/c-lucifer.c rename to link/C/c-link-lib/agents/c-lucifer.c index 2b9da08..adfb2ba 100644 --- a/link/C/Link/c-link-lib/sample-agents/c-lucifer.c +++ b/link/C/c-link-lib/agents/c-lucifer.c @@ -8,7 +8,7 @@ */ -#include +#include /* Implement the lucifer bot, which always lies expecting people to be good and always goes for the kill */ diff --git a/link/C/Link/c-link-lib/sample-agents/c-streetfighter.c b/link/C/c-link-lib/agents/c-streetfighter.c similarity index 98% rename from link/C/Link/c-link-lib/sample-agents/c-streetfighter.c rename to link/C/c-link-lib/agents/c-streetfighter.c index 2841f43..9a1d6ce 100644 --- a/link/C/Link/c-link-lib/sample-agents/c-streetfighter.c +++ b/link/C/c-link-lib/agents/c-streetfighter.c @@ -8,7 +8,7 @@ */ -#include +#include /* Implement the streetfighter bot, which thinks everyone has it in for him. */ diff --git a/link/C/Link/c-link-lib/c-link-lib.xcodeproj/project.pbxproj b/link/C/c-link-lib/c-link-lib.xcodeproj/project.pbxproj similarity index 76% rename from link/C/Link/c-link-lib/c-link-lib.xcodeproj/project.pbxproj rename to link/C/c-link-lib/c-link-lib.xcodeproj/project.pbxproj index 97722b7..467b386 100644 --- a/link/C/Link/c-link-lib/c-link-lib.xcodeproj/project.pbxproj +++ b/link/C/c-link-lib/c-link-lib.xcodeproj/project.pbxproj @@ -7,34 +7,34 @@ 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 = ""; }; - 224F59B9117D6D88003D9540 /* c-lucifer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "c-lucifer.c"; path = "sample-agents/c-lucifer.c"; sourceTree = ""; }; - 224F59BA117D889A003D9540 /* c-streetfighter.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "c-streetfighter.c"; path = "sample-agents/c-streetfighter.c"; sourceTree = ""; }; + 2291A1BB117EDB9600854CBE /* c_link.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = c_link.c; sourceTree = ""; }; + 2291A1BD117EE3FD00854CBE /* c-angel.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "c-angel.c"; sourceTree = ""; }; + 2291A1BE117EE3FD00854CBE /* c-lucifer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "c-lucifer.c"; sourceTree = ""; }; + 2291A1BF117EE3FD00854CBE /* c-streetfighter.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "c-streetfighter.c"; sourceTree = ""; }; 22F652F5117C679300A3793D /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; - 22F652F6117C6C9500A3793D /* c-link.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "c-link.h"; sourceTree = ""; }; - 22F652F7117C6C9500A3793D /* c-link.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "c-link.c"; sourceTree = ""; }; + 22F652F6117C6C9500A3793D /* c_link.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_link.h; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXGroup section */ 08FB7794FE84155DC02AAC07 /* c-link-lib */ = { isa = PBXGroup; children = ( - 224F59A3117D64B4003D9540 /* Sample Agents */, - 22F652F6117C6C9500A3793D /* c-link.h */, - 22F652F7117C6C9500A3793D /* c-link.c */, + 2291A1BC117EE3FD00854CBE /* agents */, + 22F652F6117C6C9500A3793D /* c_link.h */, + 2291A1BB117EDB9600854CBE /* c_link.c */, 22F652F5117C679300A3793D /* Makefile */, ); name = "c-link-lib"; sourceTree = ""; }; - 224F59A3117D64B4003D9540 /* Sample Agents */ = { + 2291A1BC117EE3FD00854CBE /* agents */ = { isa = PBXGroup; children = ( - 224F59B9117D6D88003D9540 /* c-lucifer.c */, - 224F59BA117D889A003D9540 /* c-streetfighter.c */, - 224F59A1117D6473003D9540 /* c-angel.c */, + 2291A1BD117EE3FD00854CBE /* c-angel.c */, + 2291A1BE117EE3FD00854CBE /* c-lucifer.c */, + 2291A1BF117EE3FD00854CBE /* c-streetfighter.c */, ); - name = "Sample Agents"; + path = agents; sourceTree = ""; }; /* End PBXGroup section */ @@ -47,7 +47,7 @@ buildPhases = ( ); buildToolPath = /usr/bin/make; - buildWorkingDirectory = "/Users/dja/Documents/dev/progcomp/link/C/Link/c-link-lib"; + buildWorkingDirectory = ""; dependencies = ( ); name = "c-link-lib"; diff --git a/link/C/Link/c-link-lib/c-link.c b/link/C/c-link-lib/c_link.c similarity index 86% rename from link/C/Link/c-link-lib/c-link.c rename to link/C/c-link-lib/c_link.c index 0b8af58..e75997f 100644 --- a/link/C/Link/c-link-lib/c-link.c +++ b/link/C/c-link-lib/c_link.c @@ -1,5 +1,5 @@ /* - * c-link.c + * c_link.c * c-link-lib * * Created by Daniel Axtens on 19/04/10. @@ -7,17 +7,15 @@ * */ -#include "c-link.h" +#include "c_link.h" #include #include #include +#include -/* If you just want to write a bot, you don't need to read this file. +/* You don't need to read this file. This merely sets up the I/O for you, so all you have to do is define the bot - functions defined in - - The only reason you would care about this info is if you want to use pointChange - and/or childSpawned parameters from the RESULTS call, which are otherwise discarded. + functions defined in */ char ITEMNAMES[3][MAXITEMLEN] = {"Rock", "Paper", "Scissors"}; diff --git a/link/C/Link/c-link-lib/c-link.h b/link/C/c-link-lib/c_link.h similarity index 96% rename from link/C/Link/c-link-lib/c-link.h rename to link/C/c-link-lib/c_link.h index a369ea8..08cdb63 100644 --- a/link/C/Link/c-link-lib/c-link.h +++ b/link/C/c-link-lib/c_link.h @@ -1,5 +1,5 @@ /* - * c-link.h + * c_link.h * c-link-lib * * Created by Daniel Axtens on 19/04/10. -- 2.20.1