diff --git a/AutoPilot b/AutoPilot new file mode 100755 index 0000000..c0edfc0 Binary files /dev/null and b/AutoPilot differ diff --git a/InterfaceCpp/.#sdlcommon.h.1.3 b/InterfaceCpp/.#sdlcommon.h.1.3 new file mode 100644 index 0000000..69ff19a --- /dev/null +++ b/InterfaceCpp/.#sdlcommon.h.1.3 @@ -0,0 +1,28 @@ +#ifndef __SDLCOMMON_H +#define __SDLCOMMON_H +#include +#include + +#ifndef PI +#define PI 3.141592 +#endif + +#ifndef NULLCOL +#define NULLCOL 0x00FF00FF + +#define NULLCOLA 0xFF +#define NULLCOLR 0xFF +#define NULLCOLG 0x00 +#define NULLCOLB 0xFF +#endif + + + +void setpixel(SDL_Surface*, int, int, Uint8, Uint8, Uint8); +int getpixel(SDL_Surface*, int, int); +void DrawLine(SDL_Surface*, int , int , int , int , char , char, char); +void rotatesurface(SDL_Surface*, SDL_Surface*, int); +void interpole(SDL_Surface* , SDL_Surface* , Uint32 ); +bool inCarArea(SDL_Surface* , int , int ); + +#endif diff --git a/InterfaceCpp/Back/CVS/Entries b/InterfaceCpp/Back/CVS/Entries new file mode 100644 index 0000000..585bb42 --- /dev/null +++ b/InterfaceCpp/Back/CVS/Entries @@ -0,0 +1,11 @@ +/bg1.bmp/1.1/Wed Apr 13 15:04:02 2005// +/bg1.dia/1.1/Wed Apr 13 15:04:03 2005// +/bg2.bmp/1.1/Wed Apr 13 15:04:03 2005// +/bg2.dia/1.1/Wed Apr 13 15:04:02 2005// +/bg3.bmp/1.1/Wed Apr 13 15:04:03 2005// +/bg3.dia/1.1/Wed Apr 13 15:04:03 2005// +/bg4.bmp/1.1/Wed Apr 13 15:04:03 2005// +/bg4.dia/1.1/Wed Apr 13 15:04:03 2005// +/bg5.bmp/1.2/Wed Apr 13 15:04:03 2005// +/bg5.dia/1.2/Wed Apr 13 15:04:03 2005// +D diff --git a/InterfaceCpp/Back/CVS/Repository b/InterfaceCpp/Back/CVS/Repository new file mode 100644 index 0000000..287ee00 --- /dev/null +++ b/InterfaceCpp/Back/CVS/Repository @@ -0,0 +1 @@ +ia2005/InterfaceCpp/Back diff --git a/InterfaceCpp/Back/CVS/Root b/InterfaceCpp/Back/CVS/Root new file mode 100644 index 0000000..547f9be --- /dev/null +++ b/InterfaceCpp/Back/CVS/Root @@ -0,0 +1 @@ +:pserver:feeling@jfroche.be:/opt/cvsroot diff --git a/InterfaceCpp/Back/bg1.bmp b/InterfaceCpp/Back/bg1.bmp new file mode 100644 index 0000000..50f60ca Binary files /dev/null and b/InterfaceCpp/Back/bg1.bmp differ diff --git a/InterfaceCpp/Back/bg1.dia b/InterfaceCpp/Back/bg1.dia new file mode 100644 index 0000000..735b08d Binary files /dev/null and b/InterfaceCpp/Back/bg1.dia differ diff --git a/InterfaceCpp/Back/bg2.bmp b/InterfaceCpp/Back/bg2.bmp new file mode 100644 index 0000000..c2f4b72 Binary files /dev/null and b/InterfaceCpp/Back/bg2.bmp differ diff --git a/InterfaceCpp/Back/bg2.dia b/InterfaceCpp/Back/bg2.dia new file mode 100644 index 0000000..f22b9c7 Binary files /dev/null and b/InterfaceCpp/Back/bg2.dia differ diff --git a/InterfaceCpp/Back/bg3.bmp b/InterfaceCpp/Back/bg3.bmp new file mode 100644 index 0000000..7c524b6 Binary files /dev/null and b/InterfaceCpp/Back/bg3.bmp differ diff --git a/InterfaceCpp/Back/bg3.dia b/InterfaceCpp/Back/bg3.dia new file mode 100644 index 0000000..9b8cc5f Binary files /dev/null and b/InterfaceCpp/Back/bg3.dia differ diff --git a/InterfaceCpp/Back/bg4.bmp b/InterfaceCpp/Back/bg4.bmp new file mode 100644 index 0000000..3a0c82e Binary files /dev/null and b/InterfaceCpp/Back/bg4.bmp differ diff --git a/InterfaceCpp/Back/bg4.dia b/InterfaceCpp/Back/bg4.dia new file mode 100644 index 0000000..1f0bcb7 Binary files /dev/null and b/InterfaceCpp/Back/bg4.dia differ diff --git a/InterfaceCpp/Back/bg5.bmp b/InterfaceCpp/Back/bg5.bmp new file mode 100644 index 0000000..744013e Binary files /dev/null and b/InterfaceCpp/Back/bg5.bmp differ diff --git a/InterfaceCpp/Back/bg5.dia b/InterfaceCpp/Back/bg5.dia new file mode 100644 index 0000000..b01a08c Binary files /dev/null and b/InterfaceCpp/Back/bg5.dia differ diff --git a/InterfaceCpp/CVS/CVS/Entries b/InterfaceCpp/CVS/CVS/Entries new file mode 100644 index 0000000..1784810 --- /dev/null +++ b/InterfaceCpp/CVS/CVS/Entries @@ -0,0 +1 @@ +D diff --git a/InterfaceCpp/CVS/CVS/Repository b/InterfaceCpp/CVS/CVS/Repository new file mode 100644 index 0000000..c5fb63d --- /dev/null +++ b/InterfaceCpp/CVS/CVS/Repository @@ -0,0 +1 @@ +ia2005/InterfaceCpp/CVS diff --git a/InterfaceCpp/CVS/CVS/Root b/InterfaceCpp/CVS/CVS/Root new file mode 100644 index 0000000..547f9be --- /dev/null +++ b/InterfaceCpp/CVS/CVS/Root @@ -0,0 +1 @@ +:pserver:feeling@jfroche.be:/opt/cvsroot diff --git a/InterfaceCpp/CVS/Entries b/InterfaceCpp/CVS/Entries new file mode 100644 index 0000000..0ebea61 --- /dev/null +++ b/InterfaceCpp/CVS/Entries @@ -0,0 +1,15 @@ +D/CVS//// +D/Cars//// +D/Back//// +/Makefile/1.4/Wed Apr 13 15:04:03 2005// +/SFont.c/1.2/Wed Apr 13 15:04:03 2005// +/SFont.h/1.1/Wed Apr 13 15:04:03 2005// +/fenetre.h/1.4/Wed Apr 13 15:04:03 2005// +/font.png/1.1/Wed Apr 13 15:04:03 2005// +/main.cpp/1.3/Wed Apr 13 15:04:03 2005// +/sdlcommon.cpp/1.5/Thu Apr 14 17:40:11 2005// +/sdlcommon.h/1.4/Thu Apr 14 17:38:15 2005// +/car.cpp/1.20/Thu Apr 14 17:36:20 2005// +/car.h/1.11/Thu Apr 14 17:34:22 2005// +/shmdata.h/1.8/Thu Apr 14 16:59:58 2005// +/fenetre.cpp/1.22/Thu Apr 14 18:45:30 2005// diff --git a/InterfaceCpp/CVS/Repository b/InterfaceCpp/CVS/Repository new file mode 100644 index 0000000..6663e7b --- /dev/null +++ b/InterfaceCpp/CVS/Repository @@ -0,0 +1 @@ +ia2005/InterfaceCpp diff --git a/InterfaceCpp/CVS/Root b/InterfaceCpp/CVS/Root new file mode 100644 index 0000000..547f9be --- /dev/null +++ b/InterfaceCpp/CVS/Root @@ -0,0 +1 @@ +:pserver:feeling@jfroche.be:/opt/cvsroot diff --git a/InterfaceCpp/Cars/CVS/Entries b/InterfaceCpp/Cars/CVS/Entries new file mode 100644 index 0000000..f7dfd1b --- /dev/null +++ b/InterfaceCpp/Cars/CVS/Entries @@ -0,0 +1,5 @@ +/voiture1.bmp/1.1/Wed Apr 13 15:04:03 2005// +/voiture2.bmp/1.1/Wed Apr 13 15:04:03 2005// +/voiture3.bmp/1.1/Wed Apr 13 15:04:03 2005// +/voiture4.bmp/1.1/Wed Apr 13 15:04:03 2005// +D diff --git a/InterfaceCpp/Cars/CVS/Repository b/InterfaceCpp/Cars/CVS/Repository new file mode 100644 index 0000000..2b79bd0 --- /dev/null +++ b/InterfaceCpp/Cars/CVS/Repository @@ -0,0 +1 @@ +ia2005/InterfaceCpp/Cars diff --git a/InterfaceCpp/Cars/CVS/Root b/InterfaceCpp/Cars/CVS/Root new file mode 100644 index 0000000..547f9be --- /dev/null +++ b/InterfaceCpp/Cars/CVS/Root @@ -0,0 +1 @@ +:pserver:feeling@jfroche.be:/opt/cvsroot diff --git a/InterfaceCpp/Cars/porsche.bmp b/InterfaceCpp/Cars/porsche.bmp new file mode 100644 index 0000000..961209b Binary files /dev/null and b/InterfaceCpp/Cars/porsche.bmp differ diff --git a/InterfaceCpp/Cars/porsche_bg.bmp b/InterfaceCpp/Cars/porsche_bg.bmp new file mode 100644 index 0000000..4ce2387 Binary files /dev/null and b/InterfaceCpp/Cars/porsche_bg.bmp differ diff --git a/InterfaceCpp/Cars/top.bmp b/InterfaceCpp/Cars/top.bmp new file mode 100644 index 0000000..9c74915 Binary files /dev/null and b/InterfaceCpp/Cars/top.bmp differ diff --git a/InterfaceCpp/Cars/voiture1.bmp b/InterfaceCpp/Cars/voiture1.bmp new file mode 100644 index 0000000..1d01a28 Binary files /dev/null and b/InterfaceCpp/Cars/voiture1.bmp differ diff --git a/InterfaceCpp/Cars/voiture2.bmp b/InterfaceCpp/Cars/voiture2.bmp new file mode 100644 index 0000000..8bed510 Binary files /dev/null and b/InterfaceCpp/Cars/voiture2.bmp differ diff --git a/InterfaceCpp/Cars/voiture3.bmp b/InterfaceCpp/Cars/voiture3.bmp new file mode 100644 index 0000000..8b71c41 Binary files /dev/null and b/InterfaceCpp/Cars/voiture3.bmp differ diff --git a/InterfaceCpp/Cars/voiture4.bmp b/InterfaceCpp/Cars/voiture4.bmp new file mode 100644 index 0000000..37c75f7 Binary files /dev/null and b/InterfaceCpp/Cars/voiture4.bmp differ diff --git a/InterfaceCpp/Makefile b/InterfaceCpp/Makefile new file mode 100644 index 0000000..3ec7168 --- /dev/null +++ b/InterfaceCpp/Makefile @@ -0,0 +1,40 @@ +#$Id: Makefile,v 1.4 2005/04/10 11:46:45 feeling Exp $' +CFLAGS= -Wno-deprecated -std=c++14 +CPP= g++ +GCC= gcc +INCLUDES= -L/usr/lib -I/usr/include/SDL +LIBS= -L/usr/lib -lSDL -lpthread -lSDL_image +all : interface +interface : fenetre.o main.o car.o sdlcommon.o SFont.o + $(CPP) fenetre.o main.o car.o sdlcommon.o SFont.o -o iface -L/usr/lib -lSDL -lpthread -lSDL_image -Wno-deprecated -std=c++14 +fenetre.o : fenetre.cpp + $(CPP) -c fenetre.cpp -L/usr/lib -I/usr/include/SDL -Wno-deprecated -std=c++14 +main.o : main.cpp + $(CPP) -c main.cpp -L/usr/lib -I/usr/include/SDL -Wno-deprecated -std=c++14 +car.o : car.cpp + $(CPP) -c car.cpp -L/usr/lib -I/usr/include/SDL -Wno-deprecated -std=c++14 +sdlcommon.o : sdlcommon.cpp + $(CPP) -c sdlcommon.cpp -L/usr/lib -I/usr/include/SDL -Wno-deprecated -std=c++14 +SFont.o : SFont.c + $(GCC) -c SFont.c -L/usr/lib -I/usr/include/SDL + +# g++ -c fenetre.cpp -L/usr/lib -I/usr/include/SDL -Wno-deprecated -std=c++14 +# g++ -c main.cpp -L/usr/lib -I/usr/include/SDL -Wno-deprecated -std=c++14 +# g++ -c car.cpp -L/usr/lib -I/usr/include/SDL -Wno-deprecated -std=c++14 +# g++ -c sdlcommon.cpp -L/usr/lib -I/usr/include/SDL -Wno-deprecated -std=c++14 +# gcc -c SFont.c -L/usr/lib -I/usr/include/SDL +# g++ fenetre.o main.o car.o sdlcommon.o SFont.o -o iface -L/usr/lib -lSDL -lpthread -lSDL_image -Wno-deprecated -std=c++14 + + +# g++ -c fenetre.cpp -L/usr/lib -I/usr/include/SDL -Wno-deprecated +# g++ -c main.cpp -L/usr/lib -I/usr/include/SDL -Wno-deprecated +# g++ -c car.cpp -L/usr/lib -I/usr/include/SDL -Wno-deprecated +# g++ -c sdlcommon.cpp -L/usr/lib -I/usr/include/SDL -Wno-deprecated +# gcc -c SFont.c -L/usr/lib -I/usr/include/SDL +# g++ fenetre.o main.o car.o sdlcommon.o SFont.o -o iface -L/usr/lib -lSDL -lpthread -lSDL_image -Wno-deprecated + +mrproper: + rm -rf *.o + rm -rf iface +clean: + rm -rf *.o diff --git a/InterfaceCpp/Makefile_ b/InterfaceCpp/Makefile_ new file mode 100644 index 0000000..80b4c11 --- /dev/null +++ b/InterfaceCpp/Makefile_ @@ -0,0 +1,32 @@ +#$Id: Makefile,v 1.4 2005/04/10 11:46:45 feeling Exp $' +CFLAGS= -Wall -g -Wno-deprecated -std=c++14 +CPP= g++ +GCC= gcc +INCLUDES= -I/usr/include/SDL +LIBS= -L/usr/lib -lSDL -lpthread -lSDL_image +all : interface +interface : fenetre.o main.o car.o sdlcommon.o SFont.o + $(CPP) $(CFLAGS) $(LIBS) -o iface fenetre.o main.o car.o sdlcommon.o SFont.o +fenetre.o : fenetre.cpp + $(CPP) $(CFLAGS) $(INCLUDES) -c fenetre.cpp +main.o : main.cpp + $(CPP) $(CFLAGS) $(INCLUDES) -c main.cpp +car.o : car.cpp + $(CPP) $(CFLAGS) $(INCLUDES) -c car.cpp +sdlcommon.o : sdlcommon.cpp + $(CPP) $(CFLAGS) $(INCLUDES) -c sdlcommon.cpp +SFont.o : SFont.c + $(CPP) $(CFLAGS) $(INCLUDES) -c SFont.c + +# g++ -c fenetre.cpp -L/usr/lib -I/usr/include/SDL -Wno-deprecated +# g++ -c main.cpp -L/usr/lib -I/usr/include/SDL -Wno-deprecated +# g++ -c car.cpp -L/usr/lib -I/usr/include/SDL -Wno-deprecated +# g++ -c sdlcommon.cpp -L/usr/lib -I/usr/include/SDL -Wno-deprecated +# gcc -c SFont.c -L/usr/lib -I/usr/include/SDL +# g++ fenetre.o main.o car.o sdlcommon.o SFont.o -o iface -L/usr/lib -lSDL -lpthread -lSDL_image -Wno-deprecated + +mrproper: + rm -rf *.o + rm -rf iface +clean: + rm -rf *.o diff --git a/InterfaceCpp/SFont.c b/InterfaceCpp/SFont.c new file mode 100644 index 0000000..2aa47e8 --- /dev/null +++ b/InterfaceCpp/SFont.c @@ -0,0 +1,189 @@ +/* SFont: a simple font-library that uses special .pngs as fonts + Copyright (C) 2003 Karl Bartel + + License: GPL or LGPL (at your choice) + WWW: http://www.linux-games.com/sfont/ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Karl Bartel + Cecilienstr. 14 + 12307 Berlin + GERMANY + karlb@gmx.net +*/ +#include + +#include +#include +#include +#include "SFont.h" + +static Uint32 GetPixel(SDL_Surface *Surface, Sint32 X, Sint32 Y) +{ + Uint8 *bits; + Uint32 Bpp; + + assert(X>=0); + assert(Xw); + + Bpp = Surface->format->BytesPerPixel; + bits = ((Uint8 *)Surface->pixels)+Y*Surface->pitch+X*Bpp; + + switch(Bpp) { + case 1: + return *((Uint8 *)Surface->pixels + Y * Surface->pitch + X); + break; + case 2: + return *((Uint16 *)Surface->pixels + Y * Surface->pitch/2 + X); + break; + case 3: { + Uint8 r, g, b; + r = *((bits)+Surface->format->Rshift/8); + g = *((bits)+Surface->format->Gshift/8); + b = *((bits)+Surface->format->Bshift/8); + return SDL_MapRGB(Surface->format, r, g, b); + } + break; + case 4: + return *((Uint32 *)Surface->pixels + Y * Surface->pitch/4 + X); + break; + } + + return 0; +} + +SFont_Font* SFont_InitFont(SDL_Surface* Surface) +{ + int x = 0, i = 0; + Uint32 pixel; + SFont_Font* Font; + Uint32 pink; + + if (Surface == NULL) + return NULL; + + Font = (SFont_Font *) malloc(sizeof(SFont_Font)); + Font->Surface = Surface; + + SDL_LockSurface(Surface); + + pink = SDL_MapRGB(Surface->format, 255, 0, 255); + while (x < Surface->w) { + if (GetPixel(Surface, x, 0) == pink) { + Font->CharPos[i++]=x; + while((x < Surface->w) && (GetPixel(Surface, x, 0)== pink)) + x++; + Font->CharPos[i++]=x; + } + x++; + } + Font->MaxPos = x-1; + + pixel = GetPixel(Surface, 0, Surface->h-1); + SDL_UnlockSurface(Surface); + SDL_SetColorKey(Surface, SDL_SRCCOLORKEY, pixel); + + return Font; +} + +void SFont_FreeFont(SFont_Font* FontInfo) +{ + SDL_FreeSurface(FontInfo->Surface); + free(FontInfo); +} + +void SFont_Write(SDL_Surface *Surface, const SFont_Font *Font, + int x, int y, const char *text) +{ + const char* c; + int charoffset; + SDL_Rect srcrect, dstrect; + + if(text == NULL) + return; + + /* these values won't change in the loop */ + srcrect.y = 1; + dstrect.y = y; + srcrect.h = dstrect.h = Font->Surface->h - 1; + + for(c = text; *c != '\0' && x <= Surface->w ; c++) { + charoffset = ((int) (*c - 33)) * 2 + 1; + /* skip spaces and nonprintable characters */ + if (*c == ' ' || charoffset < 0 || charoffset > Font->MaxPos) { + x += Font->CharPos[2]-Font->CharPos[1]; + continue; + } + + srcrect.w = dstrect.w = + (Font->CharPos[charoffset+2] + Font->CharPos[charoffset+1])/2 - + (Font->CharPos[charoffset] + Font->CharPos[charoffset-1])/2; + srcrect.x = (Font->CharPos[charoffset]+Font->CharPos[charoffset-1])/2; + dstrect.x = (Sint16)(x - (float)(Font->CharPos[charoffset] - Font->CharPos[charoffset-1])/2); + + SDL_BlitSurface(Font->Surface, &srcrect, Surface, &dstrect); + + x += Font->CharPos[charoffset+1] - Font->CharPos[charoffset]; + } +} + +int SFont_TextWidth(const SFont_Font *Font, const char *text) +{ + const char* c; + int charoffset=0; + int width = 0; + + if(text == NULL) + return 0; + + for(c = text; *c != '\0'; c++) { + charoffset = ((int) *c - 33) * 2 + 1; + /* skip spaces and nonprintable characters */ + if (*c == ' ' || charoffset < 0 || charoffset > Font->MaxPos) { + width += Font->CharPos[2]-Font->CharPos[1]; + continue; + } + + width += Font->CharPos[charoffset+1] - Font->CharPos[charoffset]; + } + + return width; +} + +int SFont_TextHeight(const SFont_Font* Font) +{ + return Font->Surface->h - 1; +} + +void SFont_WriteCenter(SDL_Surface *Surface, const SFont_Font *Font, + int y, const char *text) +{ + SFont_Write(Surface, Font, Surface->w/2 - SFont_TextWidth(Font, text)/2, + y, text); +} + +void SFont_Write_V(SDL_Surface *Surface, const SFont_Font *Font, int x, int y, + const char *text) + { + int i,ph; + char bf[4]; + ph=SFont_TextHeight(Font); + for(i=0;i<((int)strlen(text));i++) + { + sprintf(bf,"%c",text[i]); + SFont_Write(Surface,Font, x-(SFont_TextWidth(Font,bf)/2) , y+(i*ph) , bf); + } + } diff --git a/InterfaceCpp/SFont.h b/InterfaceCpp/SFont.h new file mode 100644 index 0000000..4d10629 --- /dev/null +++ b/InterfaceCpp/SFont.h @@ -0,0 +1,85 @@ +/* SFont: a simple font-library that uses special bitmaps as fonts + Copyright (C) 2003 Karl Bartel + + License: GPL or LGPL (at your choice) + WWW: http://www.linux-games.com/sfont/ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Karl Bartel + Cecilienstr. 14 + 12307 Berlin + GERMANY + karlb@gmx.net +*/ + +/************************************************************************ +* SFONT - SDL Font Library by Karl Bartel * +* * +* All functions are explained below. There are two versions of each * +* funtction. The first is the normal one, the function with the * +* 2 at the end can be used when you want to handle more than one font * +* in your program. * +* * +************************************************************************/ +#ifndef SFONT_H +#define SFONT_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/*Delcare one variable of this type for each font you are using. + To load the fonts, load the font image into YourFont->Surface + and call InitFont( YourFont ); +*/ +typedef struct { + SDL_Surface *Surface; + int CharPos[512]; + int MaxPos; +} SFont_Font; + +/* Initializes the font + Font: this contains the suface with the font. + The font must be loaded before using this function. +*/ +SFont_Font* SFont_InitFont (SDL_Surface *Font); +void SFont_FreeFont(SFont_Font* Font); + +/* Blits a string to a surface + Destination: the suface you want to blit to + text: a string containing the text you want to blit. +*/ +void SFont_Write(SDL_Surface *Surface, const SFont_Font *Font, int x, int y, + const char *text); +void SFont_Write_V(SDL_Surface *Surface, const SFont_Font *Font, int x, int y, + const char *text); + +/* Returns the width of "text" in pixels */ +int SFont_TextWidth(const SFont_Font* Font, const char *text); +/* Returns the height of "text" in pixels (which is always equal to Font->Surface->h) */ +int SFont_TextHeight(const SFont_Font* Font); + +/* Blits a string to Surface with centered x position */ +void SFont_WriteCenter(SDL_Surface *Surface, const SFont_Font* Font, int y, + const char *text); + +#ifdef __cplusplus +} +#endif + +#endif /* SFONT_H */ diff --git a/InterfaceCpp/SFont.o b/InterfaceCpp/SFont.o new file mode 100644 index 0000000..ab256aa Binary files /dev/null and b/InterfaceCpp/SFont.o differ diff --git a/InterfaceCpp/car.cpp b/InterfaceCpp/car.cpp new file mode 100644 index 0000000..759168a --- /dev/null +++ b/InterfaceCpp/car.cpp @@ -0,0 +1,313 @@ +#include +#include +#include +#include +#include +#include +#include +#include "sdlcommon.h" +#include "car.h" +#include "shmdata.h" + +using namespace std; + +Car::Car() + { + initShm(); + reset(); + showbar=1; + angstep=5; + for(int i=0;iw, voitsurf->h, 32, 0,0,0,0); + if(SDL_SetColorKey(Surface_car[i], SDL_SRCCOLORKEY | SDL_RLEACCEL, SDL_MapRGB(Surface_car[i]->format, 255,0,255)) == -1) + fprintf(stderr, "Warning: colorkey will not be used, reason: %s\n", SDL_GetError()); + rotatesurface(voitsurf,Surface_car[i],i); + } + carimage=1; + printf("Done ... (%d ms)\n",SDL_GetTicks()-cur); + } + +void Car::updateCar(SDL_Surface* screen) + { + int i; + for(i=0;(SData->read!=0) && i<200;i++) usleep(5); // on attends 1 seconde + if(i==200) + { + cout << "AutoPilot Timed Out ..."; + exit(0); + } + if(SData->Res[0]) decAngle(); + if(SData->Res[1]) incAngle(); + SData->Res[0]=0; + SData->Res[1]=0; + SData->pos_x+=getSpeed()*(cos(SData->angle*PI/180)); + SData->pos_y+=getSpeed()*(sin(SData->angle*PI/180)); + showTrainee(screen); + showCamera(screen); /* obligé pour avoir les pixels :-) */ + // CAMERASIZE // CAMERASTEP + if(carimage) /* on blit la voiture */ + { + SDL_Rect r; + r.w=Surface_car[SData->angle]->w; + r.h=Surface_car[SData->angle]->h; + r.x=(int)SData->pos_x-(r.w/2); + r.y=(int)SData->pos_y-(r.h/2); + SDL_BlitSurface( Surface_car[SData->angle], NULL, screen, &r); + } + else for(int i=0;i<20;i++) /* affichage de la voiture simplifiée (ligne rouge) */ + { + setpixel(screen,(int)(SData->pos_x-(cos(SData->angle*PI/180)*i)),(int)( SData->pos_y-(sin(SData->angle*PI/180)*i)),255,0,0); + } + for(int i=0;iV[i]=camera[i]; + } + SData->read=1; /* on a lu :D */ + //cout << endl; + } + +void Car::showTrainee(SDL_Surface* screen) + { + int k; + trainee[traineepos][0]=(int)SData->pos_x; + trainee[traineepos][1]=(int)SData->pos_y; + traineepos=(traineepos+1)%traineesize; + k=traineepos; + k=(k+1)%traineesize; + for(int i=0; /*i < traineesize &&*/ k!=traineepos;i++) /* affichage de la trainée */ + { + //setpixel(screen,trainee[k][0],trainee[k][1],0,(int)(i*(256.0/traineesize))%256,255); + int x0,y0,x1,y1; + x0=trainee[(k+traineesize-1)%traineesize][0]; + y0=trainee[(k+traineesize-1)%traineesize][1]; + x1=trainee[k][0]; + y1=trainee[k][1]; + if(x0==0) x0=x1; + if(y0==0) y0=y1; + if(x1==0) x1=x0; + if(y1==0) y1=y0; + DrawLine(screen,x0,y0,x1,y1,0,0,255); + k=(k+1)%traineesize; + } + + } + +void Car::showCamera(SDL_Surface* screen) + { + double x,y; + int k,ang; + x=SData->pos_x + ( cos(SData->angle*PI/180) * CAMERADISTANCE ); + y=SData->pos_y + ( sin(SData->angle*PI/180) * CAMERADISTANCE ); + ang=(SData->angle+90)%360; + x-=CAMERASIZE/2*cos(ang*PI/180); + y-=CAMERASIZE/2*sin(ang*PI/180); + k=0; + for(int i=0;i0 && xw && y>0 && yh) + camera[k]=(((getpixel(screen,(int)x,(int)y))%2)+1)%2; + else camera[k]=0; + + if(camera[k] && showbar) + { + setpixel(screen, (int)x, (int)y,255,0,0); + //setpixel(screen, (int)x, (int)y-1,255,0,0); + //setpixel(screen, (int)x-1, (int)y,255,0,0); + //setpixel(screen, (int)x-1, (int)y-1,255,0,0); + } + else if(showbar) + { + setpixel(screen, (int)x, (int)y,0,255,0); + //setpixel(screen, (int)x, (int)y-1,0,255,0); + //setpixel(screen, (int)x-1, (int)y,0,255,0); + //setpixel(screen, (int)x-1, (int)y-1,0,255,0); + } + k++; + } + else + { + if(showbar) setpixel(screen, (int)x, (int)y,0,0,255); + } + } + } + +void Car::incAngle() + { + SData->angle=(SData->angle+angstep)%360; + } +void Car::decAngle() + { + SData->angle=(SData->angle+360-angstep)%360; + } +int Car::incAngleStep(int i) + { + angstep+=i; + return angstep; + } +void Car::incSpeed() + { + if(SData->Res[2]==0) + { + SData->Res[0]=0; + SData->Res[1]=0; + SData->Res[2]=1; + if(SData->speed==0) SData->speed=1; + } + SData->speed++; + } +void Car::decSpeed() + { + SData->speed--; + } +bool Car::APToggle() + { + SData->APon=(SData->APon+1)%2; + return SData->APon; + } + +bool Car::APState() const + { + return SData->APon; + } +bool Car::neurToggle() + { + SData->Neuron=(SData->Neuron+1)%2; + return SData->Neuron; + } + +bool Car::neurState() const + { + return SData->Neuron; + } +void Car::initShm() + { + if ((shmid = shmget(SHMKEY, sizeof(struct shmdata), 0666)) < 0) + { + perror("shmget"); + exit(1); + } + if (( SData = (struct shmdata *)shmat(shmid, NULL, 0)) == (struct shmdata *) -1) + { + perror("shmat"); + exit(1); + } + } +int Car::getSpeed() const + { + if(SData->Res[2]) + return SData->speed; + return 0; + } +int Car::getAngle() const + { + return SData->angle; + } +bool Car::showBar(int i) + { + showbar=(showbar+i)%2; + return showbar; + } +bool* Car::getVect() + { + return SData->Res; + } +bool* Car::getView() + { + return SData->V; + } +void Car::reset() + { + SData->pos_x=200; + SData->pos_y=200; + SData->speed=1; + SData->angle=0; + SData->Res[2]=1; + } +void Car::turn180() + { + SData->angle=(SData->angle+180)%360; + } +int Car::incTraineeSize(int s) + { + int i,k; + if(s==0) return traineesize; + if(traineesize==1 && s<0) return traineesize; + if(traineesize+s > TRAINEESIZE) s=TRAINEESIZE-traineesize-1; + if(traineesize+s < 0) s=1-TRAINEESIZE; + int tmp[traineesize+s][2]; + k=traineepos; + if(s<0) k=(traineesize+traineepos-s)%traineesize; + for(i=0;i<(traineesize+s);i++) + { + if(i>traineesize) + { + tmp[i][0]=0; + tmp[i][1]=0; + } + else + { + tmp[i][0]=trainee[k][0]; + tmp[i][1]=trainee[k][1]; + } + k=(k+1)%traineesize; + } + for(i=0;idelay=del; + } +void Car::harakiri() + { + cout << " EXIT INTERFACE ...\n"; + SData->read=666; + usleep(100); + SData->read=666; + usleep(100); + SData->read=666; + } +void Car::saveState() + { + SData->action=SAVE_STATE; + } +void Car::loadState() + { + SData->action=RELOAD_STATE; + } +void Car::showNetwork(bool a) + { + SData->viewNetwork=a; + } +bool Car::showNetworkState() + { + return SData->viewNetwork; + } diff --git a/InterfaceCpp/car.cpp~ b/InterfaceCpp/car.cpp~ new file mode 100644 index 0000000..2aea251 --- /dev/null +++ b/InterfaceCpp/car.cpp~ @@ -0,0 +1,312 @@ +#include +#include +#include +#include +#include +#include +#include "sdlcommon.h" +#include "car.h" +#include "shmdata.h" + +using namespace std; + +Car::Car() + { + initShm(); + reset(); + showbar=1; + angstep=5; + for(int i=0;iw, voitsurf->h, 32, 0,0,0,0); + if(SDL_SetColorKey(Surface_car[i], SDL_SRCCOLORKEY | SDL_RLEACCEL, SDL_MapRGB(Surface_car[i]->format, 255,0,255)) == -1) + fprintf(stderr, "Warning: colorkey will not be used, reason: %s\n", SDL_GetError()); + rotatesurface(voitsurf,Surface_car[i],i); + } + carimage=1; + printf("Done ... (%d ms)\n",SDL_GetTicks()-cur); + } + +void Car::updateCar(SDL_Surface* screen) + { + int i; + for(i=0;(SData->read!=0) && i<200;i++) usleep(5); // on attends 1 seconde + if(i==200) + { + cout << "AutoPilot Timed Out ..."; + exit(0); + } + if(SData->Res[0]) decAngle(); + if(SData->Res[1]) incAngle(); + SData->Res[0]=0; + SData->Res[1]=0; + SData->pos_x+=getSpeed()*(cos(SData->angle*PI/180)); + SData->pos_y+=getSpeed()*(sin(SData->angle*PI/180)); + showTrainee(screen); + showCamera(screen); /* obligé pour avoir les pixels :-) */ + // CAMERASIZE // CAMERASTEP + if(carimage) /* on blit la voiture */ + { + SDL_Rect r; + r.w=Surface_car[SData->angle]->w; + r.h=Surface_car[SData->angle]->h; + r.x=(int)SData->pos_x-(r.w/2); + r.y=(int)SData->pos_y-(r.h/2); + SDL_BlitSurface( Surface_car[SData->angle], NULL, screen, &r); + } + else for(int i=0;i<20;i++) /* affichage de la voiture simplifiée (ligne rouge) */ + { + setpixel(screen,(int)(SData->pos_x-(cos(SData->angle*PI/180)*i)),(int)( SData->pos_y-(sin(SData->angle*PI/180)*i)),255,0,0); + } + for(int i=0;iV[i]=camera[i]; + } + SData->read=1; /* on a lu :D */ + //cout << endl; + } + +void Car::showTrainee(SDL_Surface* screen) + { + int k; + trainee[traineepos][0]=(int)SData->pos_x; + trainee[traineepos][1]=(int)SData->pos_y; + traineepos=(traineepos+1)%traineesize; + k=traineepos; + k=(k+1)%traineesize; + for(int i=0; /*i < traineesize &&*/ k!=traineepos;i++) /* affichage de la trainée */ + { + //setpixel(screen,trainee[k][0],trainee[k][1],0,(int)(i*(256.0/traineesize))%256,255); + int x0,y0,x1,y1; + x0=trainee[(k+traineesize-1)%traineesize][0]; + y0=trainee[(k+traineesize-1)%traineesize][1]; + x1=trainee[k][0]; + y1=trainee[k][1]; + if(x0==0) x0=x1; + if(y0==0) y0=y1; + if(x1==0) x1=x0; + if(y1==0) y1=y0; + DrawLine(screen,x0,y0,x1,y1,0,0,255); + k=(k+1)%traineesize; + } + + } + +void Car::showCamera(SDL_Surface* screen) + { + double x,y; + int k,ang; + x=SData->pos_x + ( cos(SData->angle*PI/180) * CAMERADISTANCE ); + y=SData->pos_y + ( sin(SData->angle*PI/180) * CAMERADISTANCE ); + ang=(SData->angle+90)%360; + x-=CAMERASIZE/2*cos(ang*PI/180); + y-=CAMERASIZE/2*sin(ang*PI/180); + k=0; + for(int i=0;i0 && xw && y>0 && yh) + camera[k]=(((getpixel(screen,(int)x,(int)y))%2)+1)%2; + else camera[k]=0; + + if(camera[k] && showbar) + { + setpixel(screen, (int)x, (int)y,255,0,0); + //setpixel(screen, (int)x, (int)y-1,255,0,0); + //setpixel(screen, (int)x-1, (int)y,255,0,0); + //setpixel(screen, (int)x-1, (int)y-1,255,0,0); + } + else if(showbar) + { + setpixel(screen, (int)x, (int)y,0,255,0); + //setpixel(screen, (int)x, (int)y-1,0,255,0); + //setpixel(screen, (int)x-1, (int)y,0,255,0); + //setpixel(screen, (int)x-1, (int)y-1,0,255,0); + } + k++; + } + else + { + if(showbar) setpixel(screen, (int)x, (int)y,0,0,255); + } + } + } + +void Car::incAngle() + { + SData->angle=(SData->angle+angstep)%360; + } +void Car::decAngle() + { + SData->angle=(SData->angle+360-angstep)%360; + } +int Car::incAngleStep(int i) + { + angstep+=i; + return angstep; + } +void Car::incSpeed() + { + if(SData->Res[2]==0) + { + SData->Res[0]=0; + SData->Res[1]=0; + SData->Res[2]=1; + if(SData->speed==0) SData->speed=1; + } + SData->speed++; + } +void Car::decSpeed() + { + SData->speed--; + } +bool Car::APToggle() + { + SData->APon=(SData->APon+1)%2; + return SData->APon; + } + +bool Car::APState() const + { + return SData->APon; + } +bool Car::neurToggle() + { + SData->Neuron=(SData->Neuron+1)%2; + return SData->Neuron; + } + +bool Car::neurState() const + { + return SData->Neuron; + } +void Car::initShm() + { + if ((shmid = shmget(SHMKEY, sizeof(struct shmdata), 0666)) < 0) + { + perror("shmget"); + exit(1); + } + if (( SData = (struct shmdata *)shmat(shmid, NULL, 0)) == (struct shmdata *) -1) + { + perror("shmat"); + exit(1); + } + } +int Car::getSpeed() const + { + if(SData->Res[2]) + return SData->speed; + return 0; + } +int Car::getAngle() const + { + return SData->angle; + } +bool Car::showBar(int i) + { + showbar=(showbar+i)%2; + return showbar; + } +bool* Car::getVect() + { + return SData->Res; + } +bool* Car::getView() + { + return SData->V; + } +void Car::reset() + { + SData->pos_x=200; + SData->pos_y=200; + SData->speed=1; + SData->angle=0; + SData->Res[2]=1; + } +void Car::turn180() + { + SData->angle=(SData->angle+180)%360; + } +int Car::incTraineeSize(int s) + { + int i,k; + if(s==0) return traineesize; + if(traineesize==1 && s<0) return traineesize; + if(traineesize+s > TRAINEESIZE) s=TRAINEESIZE-traineesize-1; + if(traineesize+s < 0) s=1-TRAINEESIZE; + int tmp[traineesize+s][2]; + k=traineepos; + if(s<0) k=(traineesize+traineepos-s)%traineesize; + for(i=0;i<(traineesize+s);i++) + { + if(i>traineesize) + { + tmp[i][0]=0; + tmp[i][1]=0; + } + else + { + tmp[i][0]=trainee[k][0]; + tmp[i][1]=trainee[k][1]; + } + k=(k+1)%traineesize; + } + for(i=0;idelay=del; + } +void Car::harakiri() + { + cout << " EXIT INTERFACE ...\n"; + SData->read=666; + usleep(100); + SData->read=666; + usleep(100); + SData->read=666; + } +void Car::saveState() + { + SData->action=SAVE_STATE; + } +void Car::loadState() + { + SData->action=RELOAD_STATE; + } +void Car::showNetwork(bool a) + { + SData->viewNetwork=a; + } +bool Car::showNetworkState() + { + return SData->viewNetwork; + } diff --git a/InterfaceCpp/car.h b/InterfaceCpp/car.h new file mode 100644 index 0000000..10e91fd --- /dev/null +++ b/InterfaceCpp/car.h @@ -0,0 +1,57 @@ +#ifndef __CAR_H +#define __CAR_H + +#define PI 3.141592 +#define ANGLESTEP 5 +#define TRAINEESIZE 8192 +#include "shmdata.h" + +class Car + { + private : + SDL_Surface *Surface_car[360]; + SDL_Rect rect; + bool carimage; + bool showbar; + bool camera[CAMVECT]; + struct shmdata *SData; + int shmid; + int angstep; + + int trainee[TRAINEESIZE][2]; + int traineepos; + int traineesize; + public : + Car(); + void updateCar(SDL_Surface* screen); + void loadImage(char *imagefile); + void initShm(); + + int incTraineeSize(int); + void incAngle(); + void decAngle(); + void incSpeed(); + void decSpeed(); + int incAngleStep(int); + bool APToggle(); + bool APState() const; + bool neurToggle(); + bool neurState() const; + int getSpeed() const; + int getAngle() const; + bool showBar(int i); + bool* getVect(); + bool* getView(); + void reset(); + void turn180(); + void showCamera(SDL_Surface* screen); + void showTrainee(SDL_Surface* screen); + void loadState(); + void saveState(); + void harakiri(); + void setDelay(int del); + void showNetwork(bool a); + bool showNetworkState(); + }; + +#endif diff --git a/InterfaceCpp/car.h~ b/InterfaceCpp/car.h~ new file mode 100644 index 0000000..6480ac1 --- /dev/null +++ b/InterfaceCpp/car.h~ @@ -0,0 +1,57 @@ +#ifndef __CAR_H +#define __CAR_H + +#define PI 3.141592 +#define ANGLESTEP 5 +#define TRAINEESIZE 8192 +#include "shmdata.h" + +class Car + { + private : + SDL_Surface *Surface_car[360]; + SDL_Rect rect; + bool carimage; + bool showbar; + bool camera[CAMVECT]; + struct shmdata *SData; + int shmid; + int angstep; + + int trainee[TRAINEESIZE][2]; + int traineepos; + int traineesize; + public : + Car(); + void updateCar(SDL_Surface* screen); + void loadImage(char *imagefile); + void initShm(); + + int incTraineeSize(int); + void incAngle(); + void decAngle(); + void incSpeed(); + void decSpeed(); + int incAngleStep(int); + bool APToggle(); + bool APState() const; + bool neurToggle(); + bool neurState() const; + int getSpeed() const; + int getAngle() const; + bool showBar(int i); + bool* getVect(); + bool* getView(); + void reset(); + void turn180(); + void showCamera(SDL_Surface* screen); + void showTrainee(SDL_Surface* screen); + void loadState(); + void saveState(); + void harakiri(); + void setDelay(int del); + bool showNetwork(bool a); + bool showNetworkState(); + }; + +#endif diff --git a/InterfaceCpp/car.o b/InterfaceCpp/car.o new file mode 100644 index 0000000..c56e7c3 Binary files /dev/null and b/InterfaceCpp/car.o differ diff --git a/InterfaceCpp/fenetre.cpp b/InterfaceCpp/fenetre.cpp new file mode 100644 index 0000000..f4b817b --- /dev/null +++ b/InterfaceCpp/fenetre.cpp @@ -0,0 +1,376 @@ +#include +#include +#include +#include +#include "sdlcommon.h" +#include "fenetre.h" +#include "shmdata.h" + +using namespace std; + +Fenetre::Fenetre () + { + obstacle=0; + SHOWcamera=1; + SHOWpilot=1; + fps=0; + font=SFont_InitFont(IMG_Load(FONT_PATH)); + if( SDL_Init(SDL_INIT_VIDEO) < 0 ) + { + fprintf(stderr, "Could not initialize SDL: %s\n", SDL_GetError()); + return ; + } + atexit(SDL_Quit); + screen = SDL_SetVideoMode(800,600, 32, SDL_HWSURFACE); + /* SDL_HWSURFACE / SDL_SWSURFACE */ + /*|SDL_ANYFORMAT*/ + if( screen==NULL ) + { + fprintf(stderr, "Could not create surface: %s\n", SDL_GetError()); + return ; + } + return ; + Voiture.loadImage("Cars/voiture4.bmp"); + circuit=1; + } + +Fenetre::Fenetre (int largeur = 800, int hauteur = 600, int nb_couleurs = 16, char *titre = "Fenetre SDL", char *background=NULL) + { + obstacle=0; + SHOWcamera=1; + SHOWpilot=1; + fps=0; + font=SFont_InitFont(IMG_Load(FONT_PATH)); + if (SDL_Init (SDL_INIT_VIDEO) < 0) + { + cerr << "Erreur dans l'initialisation de la librairie" << endl; + } + + screen = SDL_SetVideoMode (largeur, hauteur, nb_couleurs, SDL_HWSURFACE | SDL_DOUBLEBUF); + //SDL_CreateRGBSurface(SDL_HWSURFACE, largeur,hauteur,32,0,0,0,0); + if (screen == NULL) + { + cerr << "Erreur dans l'initialisation des modes vidéos:" << + SDL_GetError (); + SDL_Quit (); + } + SDL_WM_SetCaption (titre, NULL); + fond = SDL_LoadBMP (background); + SDL_BlitSurface (fond, NULL, screen, NULL); + SDL_Flip (screen); + HardBG=SDL_CreateRGBSurface(SDL_HWSURFACE, largeur, hauteur, 32, 0,0,0,0); + SDL_BlitSurface( fond, NULL, HardBG, NULL); + Voiture.loadImage("Cars/voiture4.bmp"); + circuit=1; + } + +void Fenetre::loadBG(char *background) + { + fond = SDL_LoadBMP (background); + SDL_BlitSurface (fond, NULL, /*screen*/HardBG, NULL); + SDL_BlitSurface( fond, NULL, HardBG, NULL); + SDL_Flip (screen); + } + +Fenetre::~Fenetre () + { + /* + if(fond) SDL_FreeSurface (fond); + if(screen) SDL_FreeSurface (screen); + */ + SDL_Quit (); + + } +void Fenetre::showView(int x,int y) + { + bool* v=Voiture.getView(); + SDL_Rect r; + r.x=x; r.y=y-1; r.h=1; r.w=4*CAMVECT; + SDL_FillRect(screen,&r, SDL_MapRGB(screen->format, 255,0,0)); + r.x=x; r.y=y+4; r.h=1; r.w=4*CAMVECT; + SDL_FillRect(screen,&r, SDL_MapRGB(screen->format, 255,0,0)); + for(int i=0;iformat, 0,0,0)); + } + } + } + +void Fenetre::showObstacle() + { + SDL_Rect r; + r.x=400; + r.y=20; + r.w=40; + r.h=screen->h-40; + SDL_FillRect(screen,&r, SDL_MapRGB(screen->format, 255,0,0)); + } + +void Fenetre::showPilot(int x,int y) + { + if(Voiture.getVect()[0]) + for(int i=0;i<16;i++) + { + for(int j=y-i;jaction=SAVE_STATE; + break; + case SDLK_x: + Voiture.loadState(); + //SData->action=RELOAD_STATE; + break; + case SDLK_F1: + printf("Chargement Circuit 1\n"); + circuit=1; + loadBG("Back/bg1.bmp"); + break; + case SDLK_F2: + printf("Chargement Circuit 2\n"); + circuit=2; + loadBG("Back/bg2.bmp"); + break; + case SDLK_F3: + printf("Chargement Circuit 3\n"); + circuit=3; + loadBG("Back/bg3.bmp"); + break; + case SDLK_F4: + printf("Chargement Circuit 4\n"); + circuit=4; + loadBG("Back/bg4.bmp"); + break; + case SDLK_F5: + printf("Chargement Circuit 5\n"); + circuit=5; + loadBG("Back/bg5.bmp"); + break; + case SDLK_F6: + printf("Chargement Circuit 6\n"); + circuit=6; + loadBG("Back/bg6.bmp"); + break; + case SDLK_F7: + Voiture.incTraineeSize(-256); + break; + case SDLK_F8: + Voiture.incTraineeSize(256); + break; + case SDLK_F9: + printf("Chargement Voiture 1\n"); + Voiture.loadImage("Cars/voiture1.bmp"); + break; + case SDLK_F10: + printf("Chargement Voiture 2\n"); + Voiture.loadImage("Cars/voiture2.bmp"); + break; + case SDLK_F11: + printf("Chargement Voiture 3\n"); + Voiture.loadImage("Cars/voiture3.bmp"); + break; + case SDLK_F12: + printf("Chargement Voiture 4\n"); + Voiture.loadImage("Cars/voiture4.bmp"); + break; + case SDLK_PAGEUP: + Voiture.incAngleStep(1); + break; + case SDLK_PAGEDOWN: + Voiture.incAngleStep(-1); + break; + + case SDLK_HOME: + waitdel+=5; + break; + case SDLK_END: + waitdel-=5; + if(waitdel<0) waitdel=0; + break; + + default : + break; + } + break; + } + break; + } + } + } diff --git a/InterfaceCpp/fenetre.cpp~ b/InterfaceCpp/fenetre.cpp~ new file mode 100644 index 0000000..86a99a3 --- /dev/null +++ b/InterfaceCpp/fenetre.cpp~ @@ -0,0 +1,376 @@ +#include +#include +#include +#include +#include "sdlcommon.h" +#include "fenetre.h" +#include "shmdata.h" + +using namespace std; + +Fenetre::Fenetre () + { + obstacle=0; + SHOWcamera=1; + SHOWpilot=1; + fps=0; + font=SFont_InitFont(IMG_Load(FONT_PATH)); + if( SDL_Init(SDL_INIT_VIDEO) < 0 ) + { + fprintf(stderr, "Could not initialize SDL: %s\n", SDL_GetError()); + return ; + } + atexit(SDL_Quit); + screen = SDL_SetVideoMode(800,600, 32, SDL_HWSURFACE); + /* SDL_HWSURFACE / SDL_SWSURFACE */ + /*|SDL_ANYFORMAT*/ + if( screen==NULL ) + { + fprintf(stderr, "Could not create surface: %s\n", SDL_GetError()); + return ; + } + return ; + Voiture.loadImage("Cars/voiture4.bmp"); + circuit=1; + } + +Fenetre::Fenetre (int largeur = 800, int hauteur = 600, int nb_couleurs = 16, char *titre = "Fenetre SDL", char *background=NULL) + { + obstacle=0; + SHOWcamera=1; + SHOWpilot=1; + fps=0; + font=SFont_InitFont(IMG_Load(FONT_PATH)); + if (SDL_Init (SDL_INIT_VIDEO) < 0) + { + cerr << "Erreur dans l'initialisation de la librairie" << endl; + } + + screen = SDL_SetVideoMode (largeur, hauteur, nb_couleurs, SDL_HWSURFACE | SDL_DOUBLEBUF); + //SDL_CreateRGBSurface(SDL_HWSURFACE, largeur,hauteur,32,0,0,0,0); + if (screen == NULL) + { + cerr << "Erreur dans l'initialisation des modes vidéos:" << + SDL_GetError (); + SDL_Quit (); + } + SDL_WM_SetCaption (titre, NULL); + fond = SDL_LoadBMP (background); + SDL_BlitSurface (fond, NULL, screen, NULL); + SDL_Flip (screen); + HardBG=SDL_CreateRGBSurface(SDL_HWSURFACE, largeur, hauteur, 32, 0,0,0,0); + SDL_BlitSurface( fond, NULL, HardBG, NULL); + Voiture.loadImage("Cars/voiture4.bmp"); + circuit=1; + } + +void Fenetre::loadBG(char *background) + { + fond = SDL_LoadBMP (background); + SDL_BlitSurface (fond, NULL, /*screen*/HardBG, NULL); + SDL_BlitSurface( fond, NULL, HardBG, NULL); + SDL_Flip (screen); + } + +Fenetre::~Fenetre () + { + /* + if(fond) SDL_FreeSurface (fond); + if(screen) SDL_FreeSurface (screen); + */ + SDL_Quit (); + + } +void Fenetre::showView(int x,int y) + { + bool* v=Voiture.getView(); + SDL_Rect r; + r.x=x; r.y=y-1; r.h=1; r.w=4*CAMVECT; + SDL_FillRect(screen,&r, SDL_MapRGB(screen->format, 255,0,0)); + r.x=x; r.y=y+4; r.h=1; r.w=4*CAMVECT; + SDL_FillRect(screen,&r, SDL_MapRGB(screen->format, 255,0,0)); + for(int i=0;iformat, 0,0,0)); + } + } + } + +void Fenetre::showObstacle() + { + SDL_Rect r; + r.x=400; + r.y=20; + r.w=40; + r.h=screen->h-40; + SDL_FillRect(screen,&r, SDL_MapRGB(screen->format, 255,0,0)); + } + +void Fenetre::showPilot(int x,int y) + { + if(Voiture.getVect()[0]) + for(int i=0;i<16;i++) + { + for(int j=y-i;jaction=SAVE_STATE; + break; + case SDLK_x: + Voiture.loadState(); + //SData->action=RELOAD_STATE; + break; + case SDLK_F1: + printf("Chargement Circuit 1\n"); + circuit=1; + loadBG("Back/bg1.bmp"); + break; + case SDLK_F2: + printf("Chargement Circuit 2\n"); + circuit=2; + loadBG("Back/bg2.bmp"); + break; + case SDLK_F3: + printf("Chargement Circuit 3\n"); + circuit=3; + loadBG("Back/bg3.bmp"); + break; + case SDLK_F4: + printf("Chargement Circuit 4\n"); + circuit=4; + loadBG("Back/bg4.bmp"); + break; + case SDLK_F5: + printf("Chargement Circuit 5\n"); + circuit=5; + loadBG("Back/bg5.bmp"); + break; + case SDLK_F6: + printf("Chargement Circuit 6\n"); + circuit=6; + loadBG("Back/bg6.bmp"); + break; + case SDLK_F7: + Voiture.incTraineeSize(-256); + break; + case SDLK_F8: + Voiture.incTraineeSize(256); + break; + case SDLK_F9: + printf("Chargement Voiture 1\n"); + Voiture.loadImage("Cars/voiture1.bmp"); + break; + case SDLK_F10: + printf("Chargement Voiture 2\n"); + Voiture.loadImage("Cars/voiture2.bmp"); + break; + case SDLK_F11: + printf("Chargement Voiture 3\n"); + Voiture.loadImage("Cars/voiture3.bmp"); + break; + case SDLK_F12: + printf("Chargement Voiture 4\n"); + Voiture.loadImage("Cars/voiture4.bmp"); + break; + case SDLK_PAGEUP: + Voiture.incAngleStep(1); + break; + case SDLK_PAGEDOWN: + Voiture.incAngleStep(-1); + break; + + case SDLK_HOME: + waitdel+=5; + break; + case SDLK_END: + waitdel-=5; + if(waitdel<0) waitdel=0; + break; + + default : + break; + } + break; + } + break; + } + } + } diff --git a/InterfaceCpp/fenetre.h b/InterfaceCpp/fenetre.h new file mode 100644 index 0000000..96f579d --- /dev/null +++ b/InterfaceCpp/fenetre.h @@ -0,0 +1,34 @@ +#ifndef __FENETRE_H +#define __FENETRE_H + +#include "car.h" +#include "SFont.h" +#define FONT_PATH "font.png" + +class Fenetre + { + private: + SDL_Surface* screen; + SDL_Surface* fond; + SDL_Surface* HardBG; + SFont_Font* font; + Car Voiture; + int frame,sec,fps,circuit; + bool SHOWpilot,SHOWcamera,obstacle; + + public: + Fenetre(); + Fenetre (int , int , int , char *, char *); + ~Fenetre(); + void loadBG(char *); + void redraw(); + void handle(); + void putPixel(int , int , char, char, char); + void showView(int ,int); + void showPilot(int,int); + void showObstacle(); + void drawText(); + + }; + +#endif diff --git a/InterfaceCpp/fenetre.h~ b/InterfaceCpp/fenetre.h~ new file mode 100644 index 0000000..57fe516 --- /dev/null +++ b/InterfaceCpp/fenetre.h~ @@ -0,0 +1,34 @@ +#ifndef __FENETRE_H +#define __FENETRE_H + +#include "car.h" +#include "SFont.h" +#define FONT_PATH "font.png" + +class Fenetre + { + private: + SDL_Surface* screen; + SDL_Surface* fond; + SDL_Surface* HardBG; + SFont_Font* font; + car Voiture; + int frame,sec,fps,circuit; + bool SHOWpilot,SHOWcamera,obstacle; + + public: + Fenetre(); + Fenetre (int , int , int , char *, char *); + ~Fenetre(); + void loadBG(char *); + void redraw(); + void handle(); + void putPixel(int , int , char, char, char); + void showView(int ,int); + void showPilot(int,int); + void showObstacle(); + void drawText(); + + }; + +#endif diff --git a/InterfaceCpp/fenetre.o b/InterfaceCpp/fenetre.o new file mode 100644 index 0000000..1a075f5 Binary files /dev/null and b/InterfaceCpp/fenetre.o differ diff --git a/InterfaceCpp/font.png b/InterfaceCpp/font.png new file mode 100644 index 0000000..aa893ca Binary files /dev/null and b/InterfaceCpp/font.png differ diff --git a/InterfaceCpp/iface b/InterfaceCpp/iface new file mode 100755 index 0000000..b3be105 Binary files /dev/null and b/InterfaceCpp/iface differ diff --git a/InterfaceCpp/main.cpp b/InterfaceCpp/main.cpp new file mode 100644 index 0000000..244f329 --- /dev/null +++ b/InterfaceCpp/main.cpp @@ -0,0 +1,17 @@ +#include +#include +#include "fenetre.h" + +using namespace std; + +int main() + { + + Fenetre f(800,600,32,"Auto Pilot","Back/bg1.bmp"); + + f.redraw(); + f.handle(); + + return 1; + + } diff --git a/InterfaceCpp/main.o b/InterfaceCpp/main.o new file mode 100644 index 0000000..54f2fa2 Binary files /dev/null and b/InterfaceCpp/main.o differ diff --git a/InterfaceCpp/sdlcommon.cpp b/InterfaceCpp/sdlcommon.cpp new file mode 100644 index 0000000..add4f32 --- /dev/null +++ b/InterfaceCpp/sdlcommon.cpp @@ -0,0 +1,238 @@ +#include +#include +#include +#include +#include "sdlcommon.h" + +bool inCarArea(SDL_Surface *screen, int x, int y) + { + if(x<0 || y<0 || x>screen->w || y>screen->h) return 0; + if(x<320 && y<100) return 0; + //DrawLine(screen,0,100,320,100,0,0,128); + return 1; + } + +void setpixel(SDL_Surface *screen, int x, int y, Uint8 r, Uint8 g, Uint8 b) + { + Uint8 *ubuff8; + Uint16 *ubuff16; + Uint32 *ubuff32; + Uint32 color; + char c1, c2, c3; + + if(x >= screen->w || x < 0 || y >= screen->h || y <0 ) return; + + if(SDL_MUSTLOCK(screen)) + { + if(SDL_LockSurface(screen) < 0) + return; + } + color = SDL_MapRGB( screen->format, r, g, b ); + switch(screen->format->BytesPerPixel) + { + case 1: + ubuff8 = (Uint8*) screen->pixels; + ubuff8 += (y * screen->pitch) + x; + *ubuff8 = (Uint8) color; + break; + case 2: + ubuff8 = (Uint8*) screen->pixels; + ubuff8 += (y * screen->pitch) + (x*2); + ubuff16 = (Uint16*) ubuff8; + *ubuff16 = (Uint16) color; + break; + case 3: + ubuff8 = (Uint8*) screen->pixels; + ubuff8 += (y * screen->pitch) + (x*3); + if(SDL_BYTEORDER == SDL_LIL_ENDIAN) + { + c1 = (color & 0xFF0000) >> 16; + c2 = (color & 0x00FF00) >> 8; + c3 = (color & 0x0000FF); + } + else { + c3 = (color & 0xFF0000) >> 16; + c2 = (color & 0x00FF00) >> 8; + c1 = (color & 0x0000FF); + } + ubuff8[0] = c3; + ubuff8[1] = c2; + ubuff8[2] = c1; + break; + case 4: + ubuff8 = (Uint8*) screen->pixels; + ubuff8 += (y*screen->pitch) + (x*4); + ubuff32 = (Uint32*)ubuff8; + *ubuff32 = color; + break; + default: + fprintf(stderr, "Error: Unknown bitdepth!\n"); + } + if(SDL_MUSTLOCK(screen)) + { + SDL_UnlockSurface(screen); + } + } + +int getpixel(SDL_Surface *screen, int x, int y) + { + int bpp = screen->format->BytesPerPixel; + Uint8 *p = (Uint8 *)screen->pixels + y * screen->pitch + x * bpp; + switch(bpp) + { + case 1: + return *p; + case 2: + return *(Uint16 *)p; + case 3: + if(SDL_BYTEORDER == SDL_BIG_ENDIAN) + return p[0] << 16 | p[1] << 8 | p[2]; + else + return p[0] | p[1] << 8 | p[2] << 16; + case 4: + return *(Uint32 *)p; + default: + return 0; + } + } + +void interpole(SDL_Surface* src, SDL_Surface* dst, Uint32 nulcol) + { + /* Interpolation */ + Uint32 ipol; + for(int i=1;i< (src->w-1) ;i++) + for(int j=1;j< (src->h-1);j++) + { + if((ipol=getpixel(src,i,j))==nulcol) + { + Uint32 ir=0,ig=0,ib=0; + int tot=0; + if((ipol=getpixel(src,i-1,j-1))!=NULLCOL){ + ir+=(ipol>>16)%256; ig+=(ipol>>8)%256; ib+=(ipol)%256; + tot++; + } + if((ipol=getpixel(src,i-1,j-1))!=NULLCOL){ + ir+=(ipol>>16)%256; ig+=(ipol>>8)%256; ib+=(ipol)%256; + tot++; + } + if((ipol=getpixel(src,i-1,j-1))!=NULLCOL){ + ir+=(ipol>>16)%256; ig+=(ipol>>8)%256; ib+=(ipol)%256; + tot++; + } + if((ipol=getpixel(src,i-1,j-1))!=NULLCOL){ + ir+=(ipol>>16)%256; ig+=(ipol>>8)%256; ib+=(ipol)%256; + tot++; + } + if((ipol=getpixel(src,i-1,j-1))!=NULLCOL){ + ir+=(ipol>>16)%256; ig+=(ipol>>8)%256; ib+=(ipol)%256; + tot++; + } + if((ipol=getpixel(src,i-1,j-1))!=NULLCOL){ + ir+=(ipol>>16)%256; ig+=(ipol>>8)%256; ib+=(ipol)%256; + tot++; + } + if((ipol=getpixel(src,i-1,j-1))!=NULLCOL){ + ir+=(ipol>>16)%256; ig+=(ipol>>8)%256; ib+=(ipol)%256; + tot++; + } + if((ipol=getpixel(src,i-1,j-1))!=NULLCOL){ + ir+=(ipol>>16)%256; ig+=(ipol>>8)%256; ib+=(ipol)%256; + tot++; + } + + + if((ipol=getpixel(src,i,j-2))!=NULLCOL){ + ir+=(ipol>>16)%256; ig+=(ipol>>8)%256; ib+=(ipol)%256; + tot++; + } + if((ipol=getpixel(src,i,j+1))!=NULLCOL){ + ir+=(ipol>>16)%256; ig+=(ipol>>8)%256; ib+=(ipol)%256; + tot++; + } + if((ipol=getpixel(src,i-2,j))!=NULLCOL){ + ir+=(ipol>>16)%256; ig+=(ipol>>8)%256; ib+=(ipol)%256; + tot++; + } + if((ipol=getpixel(src,i+2,j))!=NULLCOL){ + ir+=(ipol>>16)%256; ig+=(ipol>>8)%256; ib+=(ipol)%256; + tot++; + } + + if(tot>3) + { + ir/=tot; + ig/=tot; + ib/=tot; + //printf("interpol pixel %d,%d, with %d,%d,%d (%d)\n",i,j,ir,ig,ib,tot); + setpixel(dst,i,j,(Uint8)ir,(Uint8)ig,(Uint8)ib); + //setpixel(dst,i,j,255,0,0); + } + // else pixel à interpolé entouré de rien ... + } + else { + setpixel(dst,i,j,(Uint8)(ipol>>16),(Uint8)(ipol>>8),(Uint8)(ipol)); + //setpixel(dst,i,j,0,255,0); + } + + } + } + +void DrawLine(SDL_Surface* screen, int x1, int y1, int x2, int y2, char r, char g, char b) + { + double dx,dy,x,y; + int step,i; + if(abs(x2-x1)>abs(y2-y1)) step=abs(x2-x1); + else step=abs(y2-y1); + dx=(x2-x1); + dy=(y2-y1); + dx/=step; + dy/=step; + x=x1; + y=y1; + for(i=0;ih; + rec.w=src->w; + rec.x=0; + rec.y=0; + +tmp=SDL_CreateRGBSurface(SDL_HWSURFACE, src->w, src->h, 32, 0,0,0,0); +SDL_FillRect(tmp,&rec, SDL_MapRGB(tmp->format,NULLCOLR,NULLCOLG,NULLCOLB/**/)); +SDL_FillRect(dst,&rec, SDL_MapRGB(tmp->format,NULLCOLR,NULLCOLG,NULLCOLB/**/)); + + for(int i=0;iw;i++) + for(int j=0;jh;j++) + { + pix=getpixel(src,i,j); + r=pix>>16; // couleur R + g=pix>>8; // couleur G + b=pix; // couleur B + ba=(src->w/2)-i; // base + ca=(src->h/2)-j; // cote adjascent + norm=sqrt(ba*ba+ca*ca); // norme + angle=atan(ca/ba); // angle + if(i>(src->w)/2) angle+=(PI); + angle+=(anginc*PI/180); // angle tourné + x=(int)round((src->w/2)-(norm*cos(angle))); + y=(int)round((src->h/2)-(norm*sin(angle))); + setpixel(tmp, x,y, r,g,b); + } + pix=getpixel(src,(src->w/2),(src->h/2)); + setpixel(tmp, (src->w/2),(src->h/2), pix>>16,pix>>8,pix); + +//SDL_BlitSurface(tmp , NULL, dst, NULL); + interpole(tmp,dst, NULLCOL); + } diff --git a/InterfaceCpp/sdlcommon.h b/InterfaceCpp/sdlcommon.h new file mode 100644 index 0000000..69ff19a --- /dev/null +++ b/InterfaceCpp/sdlcommon.h @@ -0,0 +1,28 @@ +#ifndef __SDLCOMMON_H +#define __SDLCOMMON_H +#include +#include + +#ifndef PI +#define PI 3.141592 +#endif + +#ifndef NULLCOL +#define NULLCOL 0x00FF00FF + +#define NULLCOLA 0xFF +#define NULLCOLR 0xFF +#define NULLCOLG 0x00 +#define NULLCOLB 0xFF +#endif + + + +void setpixel(SDL_Surface*, int, int, Uint8, Uint8, Uint8); +int getpixel(SDL_Surface*, int, int); +void DrawLine(SDL_Surface*, int , int , int , int , char , char, char); +void rotatesurface(SDL_Surface*, SDL_Surface*, int); +void interpole(SDL_Surface* , SDL_Surface* , Uint32 ); +bool inCarArea(SDL_Surface* , int , int ); + +#endif diff --git a/InterfaceCpp/sdlcommon.h~ b/InterfaceCpp/sdlcommon.h~ new file mode 100644 index 0000000..58ad715 --- /dev/null +++ b/InterfaceCpp/sdlcommon.h~ @@ -0,0 +1,26 @@ +#ifndef __SDLCOMMON_H +#define __SDLCOMMON_H + +#ifndef PI +#define PI 3.141592 +#endif + +#ifndef NULLCOL +#define NULLCOL 0x00FF00FF + +#define NULLCOLA 0xFF +#define NULLCOLR 0xFF +#define NULLCOLG 0x00 +#define NULLCOLB 0xFF +#endif + + + +void setpixel(SDL_Surface*, int, int, Uint8, Uint8, Uint8); +int getpixel(SDL_Surface*, int, int); +void DrawLine(SDL_Surface*, int , int , int , int , char , char, char); +void rotatesurface(SDL_Surface*, SDL_Surface*, int); +void interpole(SDL_Surface* , SDL_Surface* , Uint32 ); +bool inCarArea(SDL_Surface* , int , int ); + +#endif diff --git a/InterfaceCpp/sdlcommon.o b/InterfaceCpp/sdlcommon.o new file mode 100644 index 0000000..bf69d30 Binary files /dev/null and b/InterfaceCpp/sdlcommon.o differ diff --git a/InterfaceCpp/shmdata.h b/InterfaceCpp/shmdata.h new file mode 100644 index 0000000..4b8ebd5 --- /dev/null +++ b/InterfaceCpp/shmdata.h @@ -0,0 +1,34 @@ +#ifndef __SHMDATA_H +#define __SHMDATA_H +#define SHMKEY 5678 + +#define CAMERASIZE 128 +#define CAMERASTEP 2 +#define CAMERADISTANCE 50 +#define CAMVECT (CAMERASIZE/CAMERASTEP) + +#define NOMBRE_NEURONES_INTERMEDIAIRES 8 +#define TAILLERESULTAT 3 + +#define SAVE_STATE 1 +#define RELOAD_STATE 2 +#define STATE_FILE "State.network" + +struct shmdata + { + bool V[CAMVECT]; /* vecteur camera */ + bool Res[3]; /* 0 gauche 1 droite 2 avancer 3 stop*/ + int read; /* 1 = info a ete traitée */ + int angle; /* angle de la voiture 0->359 */ + int speed; /* vitesse */ + int APon; /* pilote automatique (mode apprentissage) (0/1) */ + int Neuron; /* activer le reseau de neurone (0/1) */ + double pos_x; /* position x de la voiture */ + double pos_y; /* position y de la voiture */ + int action; /* action a executer (genre sauvegarde) */ + int delay; /* delai entre les frames */ + bool viewNetwork; /* afficher le reseau */ + }; + +#endif + diff --git a/InterfaceCpp/shmdata.h~ b/InterfaceCpp/shmdata.h~ new file mode 100644 index 0000000..a83703b --- /dev/null +++ b/InterfaceCpp/shmdata.h~ @@ -0,0 +1,33 @@ +#ifndef __SHMDATA_H +#define __SHMDATA_H +#define SHMKEY 5678 + +#define CAMERASIZE 128 +#define CAMERASTEP 2 +#define CAMERADISTANCE 50 +#define CAMVECT (CAMERASIZE/CAMERASTEP) + +#define NOMBRE_NEURONES_INTERMEDIAIRES 8 +#define TAILLERESULTAT 3 + +#define SAVE_STATE 1 +#define RELOAD_STATE 2 +#define STATE_FILE "State.network" + +struct shmdata + { + bool V[CAMVECT]; /* vecteur camera */ + bool Res[3]; /* 0 gauche 1 droite 2 avancer 3 stop*/ + int read; /* 1 = info a ete traitée */ + int angle; /* angle de la voiture 0->359 */ + int speed; /* vitesse */ + int APon; /* pilote automatique (mode apprentissage) (0/1) */ + int Neuron; /* activer le reseau de neurone (0/1) */ + double pos_x; /* position x de la voiture */ + double pos_y; /* position y de la voiture */ + int action; /* action a executer (genre sauvegarde) */ + int delay; /* delai entre les frames */ + }; + +#endif + diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..256be85 --- /dev/null +++ b/Makefile @@ -0,0 +1,31 @@ +CFLAGS= -g -fpermissive +CPP= g++ +GCC= gcc +MAKE = make +#INCLUDES= -I ./Include +all : backprops interface autopilot + @mv server/AutoPilot ./ +backprops : + @$(MAKE) -C backprop +interface : + @$(MAKE) -C InterfaceCpp +autopilot : + @$(MAKE) -C server +clean : cleanbackprop cleaninterface cleanautopilot +cleanbackprop : + @$(MAKE) -C backprop clean +cleaninterface : + @$(MAKE) -C InterfaceCpp clean +cleanautopilot : + @$(MAKE) -C server clean + +mrproper : mrproperbackprop mrproperinterface mrproperautopilot + rm -rf AutoPilot +mrproperbackprop : + @$(MAKE) -C backprop mrproper +mrproperinterface : + @$(MAKE) -C InterfaceCpp mrproper +mrproperautopilot : + @$(MAKE) -C server mrproper + + diff --git a/Rapport/CVS/Entries b/Rapport/CVS/Entries new file mode 100644 index 0000000..8b5492a --- /dev/null +++ b/Rapport/CVS/Entries @@ -0,0 +1,4 @@ +D/manuel_interface//// +/class1.dia/1.2/Wed Apr 13 15:04:04 2005// +/interfaceUML.dia/1.1/Wed Apr 13 15:04:04 2005// +/reseau.dia/1.1/Wed Apr 13 15:06:49 2005// diff --git a/Rapport/CVS/Repository b/Rapport/CVS/Repository new file mode 100644 index 0000000..1031d3f --- /dev/null +++ b/Rapport/CVS/Repository @@ -0,0 +1 @@ +ia2005/Rapport diff --git a/Rapport/CVS/Root b/Rapport/CVS/Root new file mode 100644 index 0000000..547f9be --- /dev/null +++ b/Rapport/CVS/Root @@ -0,0 +1 @@ +:pserver:feeling@jfroche.be:/opt/cvsroot diff --git a/Rapport/class1.dia b/Rapport/class1.dia new file mode 100644 index 0000000..9fee036 --- /dev/null +++ b/Rapport/class1.dia @@ -0,0 +1,1860 @@ + + + + + + + + + + + + + #A4# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Neurone# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Couche# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Reseau# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Synapse# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #SynapseMatrix# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Utils# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #InputCouche# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #HiddenCouche# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #OutputCouche# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + + + + + + ## + + + ## + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + + + + + + ## + + + ## + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + + + + + + ## + + + ## + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + + + + + + ## + + + ## + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + + + + + + ## + + + ## + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + + + + + + ## + + + ## + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Game# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Fenetre# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Car# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + + + + + + ## + + + ## + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + + + + + + ## + + + ## + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + diff --git a/Rapport/class1.dia~ b/Rapport/class1.dia~ new file mode 100644 index 0000000..a9c83e0 --- /dev/null +++ b/Rapport/class1.dia~ @@ -0,0 +1,1861 @@ + + + + + + + + + + + + + #A4# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Neurone# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Couche# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Reseau# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Synapse# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #SynapseMatrix# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Utils# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #InputCouche# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #HiddenCouche# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #OutputCouche# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + + + + + + ## + + + ## + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + + + + + + ## + + + ## + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + + + + + + ## + + + ## + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + + + + + + ## + + + ## + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + + + + + + ## + + + ## + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + + + + + + ## + + + ## + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Game# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + + + + + + ## + + + ## + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Fenetre# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Car# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + + + + + + ## + + + ## + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + diff --git a/Rapport/class1UML0.dia b/Rapport/class1UML0.dia new file mode 100644 index 0000000..3450b06 --- /dev/null +++ b/Rapport/class1UML0.dia @@ -0,0 +1,3827 @@ + + + + + + + + + + + + + #A4# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Neurone# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Couche# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Reseau# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #SData# + + + #struct shmdata*# + + + ## + + + ## + + + + + + + + + + + + + + #shmid# + + + #int# + + + ## + + + ## + + + + + + + + + + + + + + #util# + + + #Utils# + + + ## + + + ## + + + + + + + + + + + + + + #Icouche# + + + #InputCouche# + + + ## + + + ## + + + + + + + + + + + + + + #Hcouche# + + + #HiddenCouche# + + + ## + + + ## + + + + + + + + + + + + + + #Ocouche# + + + #OutputCouche# + + + ## + + + ## + + + + + + + + + + + + + + + + #Reseau# + + + ## + + + ## + + + + + + ## + + + + + + + + + + + + + + + + + + #~Reseau# + + + ## + + + ## + + + + + + ## + + + + + + + + + + + + + + + + + + #Reseau# + + + ## + + + ## + + + + + + ## + + + + + + + + + + + + + + + + + #In# + + + #int# + + + ## + + + ## + + + + + + + + #Hid# + + + #int# + + + ## + + + ## + + + + + + + + #Out# + + + #int# + + + ## + + + ## + + + + + + + + + + #rebuild# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + #In# + + + #int# + + + ## + + + ## + + + + + + + + #Hid# + + + #int# + + + ## + + + ## + + + + + + + + #Out# + + + #int# + + + ## + + + ## + + + + + + + + ## + + + ## + + + ## + + + ## + + + + + + + + + + #forward# + + + ## + + + #std::vector<double># + + + + + + ## + + + + + + + + + + + + + + + + + #input# + + + #bool*# + + + ## + + + ## + + + + + + + + + + #backward# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + #input# + + + #bool*# + + + ## + + + ## + + + + + + + + #target# + + + #bool*# + + + ## + + + ## + + + + + + + + ## + + + ## + + + ## + + + ## + + + + + + + + + + #learnOne# + + + ## + + + #double# + + + + + + ## + + + + + + + + + + + + + + + + + #input# + + + #bool*# + + + ## + + + ## + + + + + + + + #target# + + + #bool*# + + + ## + + + ## + + + + + + + + ## + + + ## + + + ## + + + ## + + + + + + + + + + #learnAll# + + + ## + + + #double# + + + + + + ## + + + + + + + + + + + + + + + + + #inputs# + + + #std::vector<bool*># + + + ## + + + ## + + + + + + + + #targets# + + + #std::vector<bool*># + + + ## + + + ## + + + + + + + + + + #saveState# + + + ## + + + #voild# + + + + + + ## + + + + + + + + + + + + + + + + + #filename# + + + #const char*# + + + ## + + + ## + + + + + + + + + + #loadState# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + #filename# + + + #const char*# + + + ## + + + ## + + + + + + + + + + #operator=# + + + ## + + + #Reseau&# + + + + + + ## + + + + + + + + + + + + + + + + + #c# + + + #Reseau&# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Synapse# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #SynapseMatrix# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #matrix# + + + #Synapse**# + + + ## + + + ## + + + + + + + + + + + + + + #nbrLine# + + + #unsigned int# + + + ## + + + ## + + + + + + + + + + + + + + #nbrCol# + + + #unsigned int # + + + ## + + + ## + + + + + + + + + + + + + + + + #SynapseMatrix# + + + ## + + + ## + + + + + + ## + + + + + + + + + + + + + + + + + + #SynapseMatrix# + + + ## + + + ## + + + + + + ## + + + + + + + + + + + + + + + + + #nbrL# + + + #unsigned int# + + + ## + + + ## + + + + + + + + #nbrC# + + + #unsigned int# + + + ## + + + ## + + + + + + + + + + #~Synapsematrix# + + + ## + + + ## + + + + + + ## + + + + + + + + + + + + + + + + + + #createMatrix# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + #line# + + + #unsigned int# + + + ## + + + ## + + + + + + + + #col# + + + #unsigned int# + + + ## + + + ## + + + + + + + + + + #deleteMatrix# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + + #getLineCount# + + + ## + + + #unsigned int# + + + + + + ## + + + + + + + + + + + + + + + + + + #getColumnCount# + + + ## + + + #unsigned int# + + + + + + ## + + + + + + + + + + + + + + + + + + #randomize# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + + #operator<<# + + + ## + + + #ostream# + + + + + + ## + + + + + + + + + + + + + + + + + #os# + + + #ostream&# + + + ## + + + ## + + + + + + + + #mat# + + + #const SynapseMatrix&# + + + ## + + + ## + + + + + + + + + + #operator()# + + + ## + + + #Synapse&# + + + + + + ## + + + + + + + + + + + + + + + + + #i# + + + #const unsigned int# + + + ## + + + ## + + + + + + + + #j# + + + #const unsigned int# + + + ## + + + ## + + + + + + + + + + #opeator=# + + + ## + + + #SynapseMatrix&# + + + + + + ## + + + + + + + + + + + + + + + + + #s# + + + #const SynapseMatrix&# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Utils# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Utils# + + + ## + + + ## + + + + + + ## + + + + + + + + + + + + + + + + + + #sigmoid# + + + ## + + + #double# + + + + + + ## + + + + + + + + + + + + + + + + + #val# + + + #double# + + + ## + + + ## + + + + + + + + + + #dsigmoid# + + + ## + + + #double# + + + + + + ## + + + + + + + + + + + + + + + + + #val# + + + #double# + + + ## + + + ## + + + + + + + + + + #accept# + + + ## + + + #bool# + + + + + + ## + + + + + + + + + + + + + + + + + #val# + + + #double# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #InputCouche# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #HiddenCouche# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #OutputCouche# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + + + + + + ## + + + ## + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + + + + + + ## + + + ## + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + + + + + + ## + + + ## + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + + + + + + ## + + + ## + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + + + + + + ## + + + ## + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + + + + + + ## + + + ## + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Game# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #shmid# + + + #int# + + + ## + + + ## + + + + + + + + + + + + + + #neurError# + + + #bool# + + + ## + + + ## + + + + + + + + + + + + + + #showOutput# + + + #bool# + + + ## + + + ## + + + + + + + + + + + + + + #data# + + + #struct shmdata*# + + + ## + + + ## + + + + + + + + + + + + + + #R# + + + #Reseau# + + + ## + + + ## + + + + + + + + + + + + + + + + #Game# + + + ## + + + ## + + + + + + ## + + + + + + + + + + + + + + + + + + #preLearn# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + + #preTest# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + + #shmCreate# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + + #pilot# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + #data# + + + #struct shmdata*# + + + ## + + + ## + + + + + + + + + + #leanThis# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + + #neuronThis# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + + #Run# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + + #toggleShow# + + + ## + + + #voild# + + + + + + ## + + + + + + + + + + + + + + + + + #t# + + + #bool# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Fenetre# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Car# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + + + + + + ## + + + ## + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + + + + + + ## + + + ## + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + diff --git a/Rapport/class1UML0.dia~ b/Rapport/class1UML0.dia~ new file mode 100644 index 0000000..fee7f0c --- /dev/null +++ b/Rapport/class1UML0.dia~ @@ -0,0 +1,3264 @@ + + + + + + + + + + + + + #A4# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Neurone# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Couche# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Reseau# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #SData# + + + #struct shmdata*# + + + ## + + + ## + + + + + + + + + + + + + + #shmid# + + + #int# + + + ## + + + ## + + + + + + + + + + + + + + #util# + + + #Utils# + + + ## + + + ## + + + + + + + + + + + + + + #Icouche# + + + #InputCouche# + + + ## + + + ## + + + + + + + + + + + + + + #Hcouche# + + + #HiddenCouche# + + + ## + + + ## + + + + + + + + + + + + + + #Ocouche# + + + #OutputCouche# + + + ## + + + ## + + + + + + + + + + + + + + + + #Reseau# + + + ## + + + ## + + + + + + ## + + + + + + + + + + + + + + + + + + #~Reseau# + + + ## + + + ## + + + + + + ## + + + + + + + + + + + + + + + + + + #Reseau# + + + ## + + + ## + + + + + + ## + + + + + + + + + + + + + + + + + #In# + + + #int# + + + ## + + + ## + + + + + + + + #Hid# + + + #int# + + + ## + + + ## + + + + + + + + #Out# + + + #int# + + + ## + + + ## + + + + + + + + + + #rebuild# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + #In# + + + #int# + + + ## + + + ## + + + + + + + + #Hid# + + + #int# + + + ## + + + ## + + + + + + + + #Out# + + + #int# + + + ## + + + ## + + + + + + + + ## + + + ## + + + ## + + + ## + + + + + + + + + + #forward# + + + ## + + + #std::vector<double># + + + + + + ## + + + + + + + + + + + + + + + + + #input# + + + #bool*# + + + ## + + + ## + + + + + + + + + + #backward# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + #input# + + + #bool*# + + + ## + + + ## + + + + + + + + #target# + + + #bool*# + + + ## + + + ## + + + + + + + + ## + + + ## + + + ## + + + ## + + + + + + + + + + #learnOne# + + + ## + + + #double# + + + + + + ## + + + + + + + + + + + + + + + + + #input# + + + #bool*# + + + ## + + + ## + + + + + + + + #target# + + + #bool*# + + + ## + + + ## + + + + + + + + ## + + + ## + + + ## + + + ## + + + + + + + + + + #learnAll# + + + ## + + + #double# + + + + + + ## + + + + + + + + + + + + + + + + + #inputs# + + + #std::vector<bool*># + + + ## + + + ## + + + + + + + + #targets# + + + #std::vector<bool*># + + + ## + + + ## + + + + + + + + + + #saveState# + + + ## + + + #voild# + + + + + + ## + + + + + + + + + + + + + + + + + #filename# + + + #const char*# + + + ## + + + ## + + + + + + + + + + #loadState# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + #filename# + + + #const char*# + + + ## + + + ## + + + + + + + + + + #operator=# + + + ## + + + #Reseau&# + + + + + + ## + + + + + + + + + + + + + + + + + #c# + + + #Reseau&# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Synapse# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #SynapseMatrix# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Utils# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Utils# + + + ## + + + ## + + + + + + ## + + + + + + + + + + + + + + + + + + #sigmoid# + + + ## + + + #double# + + + + + + ## + + + + + + + + + + + + + + + + + #val# + + + #double# + + + ## + + + ## + + + + + + + + + + #dsigmoid# + + + ## + + + #double# + + + + + + ## + + + + + + + + + + + + + + + + + #val# + + + #double# + + + ## + + + ## + + + + + + + + + + #accept# + + + ## + + + #bool# + + + + + + ## + + + + + + + + + + + + + + + + + #val# + + + #double# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #InputCouche# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #HiddenCouche# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #OutputCouche# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + + + + + + ## + + + ## + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + + + + + + ## + + + ## + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + + + + + + ## + + + ## + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + + + + + + ## + + + ## + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + + + + + + ## + + + ## + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + + + + + + ## + + + ## + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Game# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #shmid# + + + #int# + + + ## + + + ## + + + + + + + + + + + + + + #neurError# + + + #bool# + + + ## + + + ## + + + + + + + + + + + + + + #showOutput# + + + #bool# + + + ## + + + ## + + + + + + + + + + + + + + #data# + + + #struct shmdata*# + + + ## + + + ## + + + + + + + + + + + + + + #R# + + + #Reseau# + + + ## + + + ## + + + + + + + + + + + + + + + + #Game# + + + ## + + + ## + + + + + + ## + + + + + + + + + + + + + + + + + + #preLearn# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + + #preTest# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + + #shmCreate# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + + #pilot# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + #data# + + + #struct shmdata*# + + + ## + + + ## + + + + + + + + + + #leanThis# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + + #neuronThis# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + + #Run# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + + #toggleShow# + + + ## + + + #voild# + + + + + + ## + + + + + + + + + + + + + + + + + #t# + + + #bool# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Fenetre# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Car# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + + + + + + ## + + + ## + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + + + + + + ## + + + ## + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + diff --git a/Rapport/class2.dia b/Rapport/class2.dia new file mode 100644 index 0000000..325fa8e --- /dev/null +++ b/Rapport/class2.dia @@ -0,0 +1,3838 @@ + + + + + + + + + + + + + #A4# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Neurone# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Couche# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Reseau# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Synapse# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #SynapseMatrix# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Utils# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #InputCouche# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #HiddenCouche# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #OutputCouche# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + + + + + + ## + + + ## + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + + + + + + ## + + + ## + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + + + + + + ## + + + ## + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + + + + + + ## + + + ## + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + + + + + + ## + + + ## + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + + + + + + ## + + + ## + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Game# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Fenetre# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #screen# + + + #SDL_Surface*# + + + ## + + + ## + + + + + + + + + + + + + + #fond# + + + #SDL_Surface*# + + + ## + + + ## + + + + + + + + + + + + + + #HardBG# + + + #SDL_Surface*# + + + ## + + + ## + + + + + + + + + + + + + + #font# + + + #SFont_Font*# + + + ## + + + ## + + + + + + + + + + + + + + #Voiture# + + + #Car# + + + ## + + + ## + + + + + + + + + + + + + + #frame# + + + #int# + + + ## + + + ## + + + + + + + + + + + + + + #sec# + + + #int# + + + ## + + + ## + + + + + + + + + + + + + + #fps# + + + #int# + + + ## + + + ## + + + + + + + + + + + + + + #circuit# + + + #int# + + + ## + + + ## + + + + + + + + + + + + + + #SHOWpilot# + + + #bool# + + + ## + + + ## + + + + + + + + + + + + + + #SHOWcamera# + + + #bool# + + + ## + + + ## + + + + + + + + + + + + + + #obstacle# + + + #bool# + + + ## + + + ## + + + + + + + + + + + + + + + + #Fenetre# + + + ## + + + ## + + + + + + ## + + + + + + + + + + + + + + + + + + #Fenetre# + + + ## + + + ## + + + + + + ## + + + + + + + + + + + + + + + + + #largeur# + + + #int# + + + #800# + + + ## + + + + + + + + #hauteur# + + + #int# + + + #600# + + + ## + + + + + + + + #nb_couleur# + + + #int# + + + #32# + + + ## + + + + + + + + #titre# + + + #char*# + + + ## + + + ## + + + + + + + + #background# + + + #char*# + + + ## + + + ## + + + + + + + + + + #~Fenetre# + + + ## + + + ## + + + + + + ## + + + + + + + + + + + + + + + + + + #loadBG# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + #background# + + + #char*# + + + ## + + + ## + + + + + + + + + + #redraw# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + + #handle# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + + #putPixel# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + #x# + + + #int# + + + ## + + + ## + + + + + + + + #y# + + + #int# + + + ## + + + ## + + + + + + + + #r# + + + #char# + + + ## + + + ## + + + + + + + + #g# + + + #char# + + + ## + + + ## + + + + + + + + #b# + + + #char# + + + ## + + + ## + + + + + + + + ## + + + ## + + + ## + + + ## + + + + + + + + + + #showView# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + #x# + + + #int# + + + ## + + + ## + + + + + + + + #y# + + + #int# + + + ## + + + ## + + + + + + + + ## + + + ## + + + ## + + + ## + + + + + + + + + + #showPilot# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + #x# + + + #int# + + + ## + + + ## + + + + + + + + #y# + + + #int# + + + ## + + + ## + + + + + + + + ## + + + ## + + + ## + + + ## + + + + + + + + + + #showObstacle# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + + #drawText# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Car# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Surface_car[360]# + + + #SDL_Surface*# + + + ## + + + ## + + + + + + + + + + + + + + #rect# + + + #SDL_Rect# + + + ## + + + ## + + + + + + + + + + + + + + #carimage# + + + #bool# + + + #1# + + + ## + + + + + + + + + + + + + + #showbar# + + + #bool# + + + #1# + + + ## + + + + + + + + + + + + + + #camera[64]# + + + #bool# + + + ## + + + ## + + + + + + + + + + + + + + #SData# + + + #struct shmdata*# + + + ## + + + ## + + + + + + + + + + + + + + #shmid# + + + #int# + + + ## + + + ## + + + + + + + + + + + + + + #angstep# + + + #int# + + + ## + + + ## + + + + + + + + + + + + + + #trainee[8192][2]# + + + #bool# + + + ## + + + ## + + + + + + + + + + + + + + #traineepos# + + + #int# + + + ## + + + ## + + + + + + + + + + + + + + #traineesize# + + + #int# + + + ## + + + ## + + + + + + + + + + + + + + + + #Car# + + + ## + + + ## + + + + + + ## + + + + + + + + + + + + + + + + + + #updateCar# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + + #loadImage# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + + #initShm# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + + #incTraineeSize# + + + ## + + + #int# + + + + + + ## + + + + + + + + + + + + + + + + + + #incAngle# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + + #decAngle# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + + #incAngleStep# + + + ## + + + #int# + + + + + + ## + + + + + + + + + + + + + + + + + + #APToggle# + + + ## + + + #bool# + + + + + + ## + + + + + + + + + + + + + + + + + + #APState# + + + ## + + + #bool# + + + + + + ## + + + + + + + + + + + + + + + + + + #neurToggle# + + + ## + + + #bool# + + + + + + ## + + + + + + + + + + + + + + + + + + #neurState# + + + ## + + + #bool# + + + + + + ## + + + + + + + + + + + + + + + + + + #getSpeed# + + + ## + + + #int# + + + + + + ## + + + + + + + + + + + + + + + + + + #getAngle# + + + ## + + + #int# + + + + + + ## + + + + + + + + + + + + + + + + + + #showBar# + + + ## + + + #bool# + + + + + + ## + + + + + + + + + + + + + + + + + + #getVect# + + + ## + + + #bool*# + + + + + + ## + + + + + + + + + + + + + + + + + + #getView# + + + ## + + + #bool*# + + + + + + ## + + + + + + + + + + + + + + + + + + #reset# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + + #turn180# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + + #showCamera# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + #Screen# + + + #SDL_Surface*# + + + ## + + + ## + + + + + + + + + + #showTrainee# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + #Screen# + + + #SDL_Surface*# + + + ## + + + ## + + + + + + + + + + #loadState# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + + #saveState# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + + #harakiri# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + + #setDelay# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + #del# + + + #int# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + + + + + + ## + + + ## + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + + + + + + ## + + + ## + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + diff --git a/Rapport/class2.dia~ b/Rapport/class2.dia~ new file mode 100644 index 0000000..9fee036 --- /dev/null +++ b/Rapport/class2.dia~ @@ -0,0 +1,1860 @@ + + + + + + + + + + + + + #A4# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Neurone# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Couche# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Reseau# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Synapse# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #SynapseMatrix# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Utils# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #InputCouche# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #HiddenCouche# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #OutputCouche# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + + + + + + ## + + + ## + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + + + + + + ## + + + ## + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + + + + + + ## + + + ## + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + + + + + + ## + + + ## + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + + + + + + ## + + + ## + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + + + + + + ## + + + ## + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Game# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Fenetre# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Car# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + + + + + + ## + + + ## + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + + + + + + ## + + + ## + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + diff --git a/Rapport/interfaceUML.dia b/Rapport/interfaceUML.dia new file mode 100644 index 0000000..d941738 --- /dev/null +++ b/Rapport/interfaceUML.dia @@ -0,0 +1,2306 @@ + + + + + + + + + + + + + #A4# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Fenetre# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #screen# + + + #SDL_Surface*# + + + ## + + + ## + + + + + + + + + + + + + + #fond# + + + #SDL_Surface*# + + + ## + + + ## + + + + + + + + + + + + + + #HardBG# + + + #SDL_Surface*# + + + ## + + + ## + + + + + + + + + + + + + + #font# + + + #SFont_Font*# + + + ## + + + ## + + + + + + + + + + + + + + #Voiture# + + + #Car# + + + ## + + + ## + + + + + + + + + + + + + + #frame# + + + #int# + + + ## + + + ## + + + + + + + + + + + + + + #sec# + + + #int# + + + ## + + + ## + + + + + + + + + + + + + + #fps# + + + #int# + + + ## + + + ## + + + + + + + + + + + + + + #circuit# + + + #int# + + + ## + + + ## + + + + + + + + + + + + + + #SHOWpilot# + + + #bool# + + + ## + + + ## + + + + + + + + + + + + + + #SHOWcamera# + + + #bool# + + + ## + + + ## + + + + + + + + + + + + + + #obstacle# + + + #bool# + + + ## + + + ## + + + + + + + + + + + + + + + + #Fenetre# + + + ## + + + ## + + + + + + ## + + + + + + + + + + + + + + + + + + #Fenetre# + + + ## + + + ## + + + + + + ## + + + + + + + + + + + + + + + + + #largeur# + + + #int# + + + #800# + + + ## + + + + + + + + #hauteur# + + + #int# + + + #600# + + + ## + + + + + + + + #nb_couleur# + + + #int# + + + #32# + + + ## + + + + + + + + #titre# + + + #char*# + + + ## + + + ## + + + + + + + + #background# + + + #char*# + + + ## + + + ## + + + + + + + + + + #~Fenetre# + + + ## + + + ## + + + + + + ## + + + + + + + + + + + + + + + + + + #loadBG# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + #background# + + + #char*# + + + ## + + + ## + + + + + + + + + + #redraw# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + + #handle# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + + #putPixel# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + #x# + + + #int# + + + ## + + + ## + + + + + + + + #y# + + + #int# + + + ## + + + ## + + + + + + + + #r# + + + #char# + + + ## + + + ## + + + + + + + + #g# + + + #char# + + + ## + + + ## + + + + + + + + #b# + + + #char# + + + ## + + + ## + + + + + + + + ## + + + ## + + + ## + + + ## + + + + + + + + + + #showView# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + #x# + + + #int# + + + ## + + + ## + + + + + + + + #y# + + + #int# + + + ## + + + ## + + + + + + + + ## + + + ## + + + ## + + + ## + + + + + + + + + + #showPilot# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + #x# + + + #int# + + + ## + + + ## + + + + + + + + #y# + + + #int# + + + ## + + + ## + + + + + + + + ## + + + ## + + + ## + + + ## + + + + + + + + + + #showObstacle# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + + #drawText# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Car# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Surface_car[360]# + + + #SDL_Surface*# + + + ## + + + ## + + + + + + + + + + + + + + #rect# + + + #SDL_Rect# + + + ## + + + ## + + + + + + + + + + + + + + #carimage# + + + #bool# + + + #1# + + + ## + + + + + + + + + + + + + + #showbar# + + + #bool# + + + #1# + + + ## + + + + + + + + + + + + + + #camera[64]# + + + #bool# + + + ## + + + ## + + + + + + + + + + + + + + #SData# + + + #struct shmdata*# + + + ## + + + ## + + + + + + + + + + + + + + #shmid# + + + #int# + + + ## + + + ## + + + + + + + + + + + + + + #angstep# + + + #int# + + + ## + + + ## + + + + + + + + + + + + + + #trainee[8192][2]# + + + #bool# + + + ## + + + ## + + + + + + + + + + + + + + #traineepos# + + + #int# + + + ## + + + ## + + + + + + + + + + + + + + #traineesize# + + + #int# + + + ## + + + ## + + + + + + + + + + + + + + + + #Car# + + + ## + + + ## + + + + + + ## + + + + + + + + + + + + + + + + + + #updateCar# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + + #loadImage# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + + #initShm# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + + #incTraineeSize# + + + ## + + + #int# + + + + + + ## + + + + + + + + + + + + + + + + + + #incAngle# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + + #decAngle# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + + #incAngleStep# + + + ## + + + #int# + + + + + + ## + + + + + + + + + + + + + + + + + + #APToggle# + + + ## + + + #bool# + + + + + + ## + + + + + + + + + + + + + + + + + + #APState# + + + ## + + + #bool# + + + + + + ## + + + + + + + + + + + + + + + + + + #neurToggle# + + + ## + + + #bool# + + + + + + ## + + + + + + + + + + + + + + + + + + #neurState# + + + ## + + + #bool# + + + + + + ## + + + + + + + + + + + + + + + + + + #getSpeed# + + + ## + + + #int# + + + + + + ## + + + + + + + + + + + + + + + + + + #getAngle# + + + ## + + + #int# + + + + + + ## + + + + + + + + + + + + + + + + + + #showBar# + + + ## + + + #bool# + + + + + + ## + + + + + + + + + + + + + + + + + + #getVect# + + + ## + + + #bool*# + + + + + + ## + + + + + + + + + + + + + + + + + + #getView# + + + ## + + + #bool*# + + + + + + ## + + + + + + + + + + + + + + + + + + #reset# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + + #turn180# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + + #showCamera# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + #Screen# + + + #SDL_Surface*# + + + ## + + + ## + + + + + + + + + + #showTrainee# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + #Screen# + + + #SDL_Surface*# + + + ## + + + ## + + + + + + + + + + #loadState# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + + #saveState# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + + #harakiri# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + + #setDelay# + + + ## + + + #void# + + + + + + ## + + + + + + + + + + + + + + + + + #del# + + + #int# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + + + + + + ## + + + ## + + + + + + + + + + + ## + + + ## + + + + + + + + + + + + + + + + diff --git a/Rapport/interfaceUML.png b/Rapport/interfaceUML.png new file mode 100644 index 0000000..383a2d7 Binary files /dev/null and b/Rapport/interfaceUML.png differ diff --git a/Rapport/manuel_interface/CVS/Entries b/Rapport/manuel_interface/CVS/Entries new file mode 100644 index 0000000..fec230f --- /dev/null +++ b/Rapport/manuel_interface/CVS/Entries @@ -0,0 +1,2 @@ +/Interface.tex/1.3/Wed Apr 13 15:04:04 2005// +D diff --git a/Rapport/manuel_interface/CVS/Repository b/Rapport/manuel_interface/CVS/Repository new file mode 100644 index 0000000..6405693 --- /dev/null +++ b/Rapport/manuel_interface/CVS/Repository @@ -0,0 +1 @@ +ia2005/Rapport/manuel_interface diff --git a/Rapport/manuel_interface/CVS/Root b/Rapport/manuel_interface/CVS/Root new file mode 100644 index 0000000..547f9be --- /dev/null +++ b/Rapport/manuel_interface/CVS/Root @@ -0,0 +1 @@ +:pserver:feeling@jfroche.be:/opt/cvsroot diff --git a/Rapport/manuel_interface/Interface.tex b/Rapport/manuel_interface/Interface.tex new file mode 100644 index 0000000..fa8c102 --- /dev/null +++ b/Rapport/manuel_interface/Interface.tex @@ -0,0 +1,67 @@ + +\documentclass[a4paper,oneside,12pt]{article} +\usepackage{supertabular,vmargin} +\usepackage[francais]{babel} +\usepackage[latin1]{inputenc} +\usepackage[T1]{fontenc} +\usepackage[dvips]{graphicx} +\usepackage{listings} + +\title{ Techniques avancées de systèmes d'exploitation \\ Projet 1 \\} +\author{ROCHE Jean-Francois \And DELEERS Laurent} +\date\today + +\begin{document} + + +\begin{tabular}{|l|l|} +\hline +Escape & quitter l'interface\\ +\hline +$\leftarrow$ & aller a gauche\\ +\hline +$\rightarrow$ & aller a droite\\ +\hline +$\uparrow$ & augmenter la vitesse\\ +\hline +$\downarrow$ & diminuer la vitesse\\ + +\hline +a & activer le pilote automatique (aprentissage)\\ +\hline +b & afficher vecteur camera\\ +\hline +c & afficher la camera\\ +\hline +n & enclencher le reseau de neurones\\ +\hline +o & afficher un obstacle\\ +\hline +p & afficher les fleches de pilotage\\ +\hline +r & repositionner la voiture dans l'ecran (reset)\\ +\hline +t & tourner la voiture de 180\\ +\hline +w & sauver l'etat du reseau\\ +\hline +x & reloader le fichier d'etat du reseau\\ +\hline +F1-F6 & Changer de circuit \\ +\hline +F7 F8 & Afficher une trainee \\ +\hline +F9-F12 & Changer de voiture \\ +\hline +Pg-Up & augmenter l'angle de virage \\ +\hline +Pg-Down & diminuer l'angle de virage\\ +\hline +Home & augmenter le delay inter frame (affichage + lent)\\ +\hline +End & diminuer le delay inter frame (affichage + rapide mais plus de CPU) +\hline +\end{tabular} + + +\end {document} diff --git a/Rapport/reseau.dia b/Rapport/reseau.dia new file mode 100755 index 0000000..6d453b2 Binary files /dev/null and b/Rapport/reseau.dia differ diff --git a/Start b/Start new file mode 100755 index 0000000..9a3fb96 --- /dev/null +++ b/Start @@ -0,0 +1,2 @@ +cd $HOME/Documents/IA/ia2005/ +./AutoPilot -n diff --git a/backprop/.#reseau.cpp.1.4 b/backprop/.#reseau.cpp.1.4 new file mode 100644 index 0000000..76b804b --- /dev/null +++ b/backprop/.#reseau.cpp.1.4 @@ -0,0 +1,94 @@ +#include "reseau.h" + +reseau::reseau(int In, int Hid, int Out) + { + Ocouche=OutputCouche(In,&Hcouche); + Hcouche=HiddenCouche(Hid,&Ocouche); + Icouche=InputCouche(Out,&Hcouche); + initshm(); + } + +reseau::~reseau() + { + } + +void reseau::forward(bool input[],bool target[]) + { + std::vector tmp; + /* on active les couches */ + for(unsigned i=0;i hidDelta; + std::vector outDelta; + /* Calcul des delta pour la couche OUPUT */ + for(unsigned i=0;i