author | peter_k
<peter_k> 2005-10-30 20:17:19 UTC |
committer | peter_k
<peter_k> 2005-10-30 20:17:19 UTC |
parent | dffe7d9d92ae183c680c798b3c2d858a5e79e518 |
poprecog/connect4/Makefile.win | +30 | -0 |
poprecog/connect4/board.c | +9 | -0 |
poprecog/connect4/boards.c | +29 | -0 |
poprecog/connect4/genboard.cpp | +63 | -0 |
poprecog/connect4/genboard.dev | +59 | -0 |
poprecog/connect4/genboard.exe | +0 | -0 |
poprecog/connect4/genboard.o | +0 | -0 |
diff --git a/poprecog/connect4/Makefile.win b/poprecog/connect4/Makefile.win new file mode 100644 index 0000000..ee7da40 --- /dev/null +++ b/poprecog/connect4/Makefile.win @@ -0,0 +1,30 @@ +# Project: genboard +# Makefile created by Dev-C++ 4.9.9.2 + +CPP = g++.exe +CC = gcc.exe +WINDRES = windres.exe +RES = +OBJ = genboard.o $(RES) +LINKOBJ = genboard.o $(RES) +LIBS = -L"D:/dcpp/lib" +INCS = -I"D:/dcpp/include" +CXXINCS = -I"D:/dcpp/lib/gcc/mingw32/3.4.2/include" -I"D:/dcpp/include/c++/3.4.2/backward" -I"D:/dcpp/include/c++/3.4.2/mingw32" -I"D:/dcpp/include/c++/3.4.2" -I"D:/dcpp/include" +BIN = genboard.exe +CXXFLAGS = $(CXXINCS) +CFLAGS = $(INCS) +RM = rm -f + +.PHONY: all all-before all-after clean clean-custom + +all: all-before genboard.exe all-after + + +clean: clean-custom + ${RM} $(OBJ) $(BIN) + +$(BIN): $(OBJ) + $(CPP) $(LINKOBJ) -o "genboard.exe" $(LIBS) + +genboard.o: genboard.cpp + $(CPP) -c genboard.cpp -o genboard.o $(CXXFLAGS) diff --git a/poprecog/connect4/board.c b/poprecog/connect4/board.c new file mode 100644 index 0000000..07bcb50 --- /dev/null +++ b/poprecog/connect4/board.c @@ -0,0 +1,9 @@ +/* Code below was generated by a machine, so please don't edit */ + +class board { + unsigned long long board[2]; + int actualPlayer; +}; + +4 - 4 +7 - 6 diff --git a/poprecog/connect4/boards.c b/poprecog/connect4/boards.c new file mode 100644 index 0000000..d4b5384 --- /dev/null +++ b/poprecog/connect4/boards.c @@ -0,0 +1,29 @@ +/* Code below was generated by a machine, so please don't edit */ + +class board { + public: + unsigned long long board[2]; + int actualPlayer; + + inline void clear() { + board[0] = 0; + board[1] = 0; + actualPlayer = 0; + } + inline int putToken44(int column); + inline int removeToken44(int column); +}; + +inline board::putToken44(int column) { + switch(column) { + case 0: + break; + case 1: + break; + case 2: + break; + case 3: + break; + }; +} + diff --git a/poprecog/connect4/genboard.cpp b/poprecog/connect4/genboard.cpp new file mode 100644 index 0000000..197500e --- /dev/null +++ b/poprecog/connect4/genboard.cpp @@ -0,0 +1,63 @@ +/** + * Connect Four AI by peter_k + * + * This single file is to create functions for quick board usage -> board.c + * + */ + +#include <cstdlib> +#include <iostream> +#include <fstream> + +using namespace std; + +typedef struct sBoardSize { + int width; + int height; +} tBoardSize; + +int main(int argc, char *argv[]) +{ + const int boardNumber = 1; + const tBoardSize boardList[boardNumber] = {{4, 4}/*, {7, 6}, {7, 7}, {8, 7}*/}; + ofstream output; + int actualBoard; + int i; + + output.open("boards.c"); + output + << "/* Code below was generated by a machine, so please don't edit */\n\n" + << "class board {\n" + << " public:\n" + << " unsigned long long board[2];\n" + << " int actualPlayer;\n\n" + << " inline void clear() {\n" + << " board[0] = 0;\n board[1] = 0;\n actualPlayer = 0;\n" + << " }\n"; + for (actualBoard=0; actualBoard<boardNumber; actualBoard++) { + output + << " inline int putToken" << boardList[actualBoard].width << boardList[actualBoard].height << "(int column);\n" + << " inline int removeToken" << boardList[actualBoard].width << boardList[actualBoard].height << "(int column);\n"; + } + output + << "};\n\n"; + + for (actualBoard=0; actualBoard<boardNumber; actualBoard++) { + output + << "inline board::putToken" << boardList[actualBoard].width << boardList[actualBoard].height << "(int column) {\n" + << " switch(column) {\n"; + for (i = 0; i < boardList[actualBoard].width; i++) { + output + << " case " << i << ":\n" + << " break;\n"; + } + output + << " };\n" + << "}\n\n"; + } + + output.close(); + + //system("PAUSE"); + return EXIT_SUCCESS; +} diff --git a/poprecog/connect4/genboard.dev b/poprecog/connect4/genboard.dev new file mode 100644 index 0000000..188ea9b --- /dev/null +++ b/poprecog/connect4/genboard.dev @@ -0,0 +1,59 @@ +[Project] +FileName=genboard.dev +Name=genboard +UnitCount=1 +Type=1 +Ver=1 +ObjFiles= +Includes= +Libs= +PrivateResource= +ResourceIncludes= +MakeIncludes= +Compiler= +CppCompiler= +Linker= +IsCpp=1 +Icon= +ExeOutput= +ObjectOutput= +OverrideOutput=0 +OverrideOutputName= +HostApplication= +Folders= +CommandLine= +UseCustomMakefile=0 +CustomMakefile= +IncludeVersionInfo=0 +SupportXPThemes=0 +CompilerSet=0 +CompilerSettings= + +[Unit1] +FileName=genboard.cpp +CompileCpp=1 +Folder= +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[VersionInfo] +Major=0 +Minor=1 +Release=1 +Build=1 +LanguageID=1033 +CharsetID=1252 +CompanyName= +FileVersion= +FileDescription=Developed using the Dev-C++ IDE +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion= +AutoIncBuildNr=0 + diff --git a/poprecog/connect4/genboard.exe b/poprecog/connect4/genboard.exe new file mode 100644 index 0000000..79a10e5 Binary files /dev/null and b/poprecog/connect4/genboard.exe differ diff --git a/poprecog/connect4/genboard.o b/poprecog/connect4/genboard.o new file mode 100644 index 0000000..ad4232c Binary files /dev/null and b/poprecog/connect4/genboard.o differ