diff --git a/obj/main.o b/obj/main.o
index 982deb19e71fb45fd96ce0099a364ee379963600..002e6f66c9d75b1012b84d6576ad88725219043c 100644
Binary files a/obj/main.o and b/obj/main.o differ
diff --git a/obj/tableau.o b/obj/tableau.o
index 6656502d35d47551951fdca5d99e6a56502da20d..71278f037ff174ed6f999b3f36e0ef37428143f3 100644
Binary files a/obj/tableau.o and b/obj/tableau.o differ
diff --git a/src/deplacement.c b/src/deplacement.c
index 51739334dd721cf6b3669c93cfc5b83ba4719afc..e38f926d2779c6c2bf9fc953ec4dd2d89eeb945d 100644
--- a/src/deplacement.c
+++ b/src/deplacement.c
@@ -78,7 +78,7 @@ void case_destination(pile **tableau,int N,int i_src,int j_src, int *i_dest,int
         tmp=tmp->next;
       }
       if (valide){
-        effectuer(tableau,i_src,j_src,*i_dest,*j_dest,nb);
+        effectuer(tableau,i_src,j_src,*i_dest,*j_dest,nb,*tour);
         *tour=*tour+1;
       } else {
         printf("Déplacement illégal pour au moins un pion de la pile");
@@ -211,26 +211,23 @@ int fous(pile** tableau,int i_src,int j_src,int i_dest, int j_dest)
 
 int cavaliers(pile **tableau,int i_src,int j_src,int i_dest,int j_dest)
 {
-  if (i_dest==i_src+2 || i_dest==i_src-2){
-    if (j_dest==j_src+1 || j_dest==j_src-1){
-      return 1;
-    }
-  } else if (j_dest==j_src+2 || j_dest==j_src-2){
-    if (i_dest==i_src+1 || i_dest==i_src-1){
-      return 1;
-    }
+  if ((i_dest==i_src+2 && longueur_pile(tableau[i_src+1][j_src])==0 && longueur_pile(tableau[i_src+2][j_src])==0) || (i_dest==i_src-2 && longueur_pile(tableau[i_src-1][j_src])==0 && longueur_pile(tableau[i_src-1][j_src])==0)){
+    if (j_dest==j_src+1 || j_dest==j_src-1) return 1;
+  } else if ((j_dest==j_src+2 && longueur_pile(tableau[i_src][j_src+1])==0 && longueur_pile(tableau[i_src][j_src+2])==0) || (j_dest==j_src-2 && longueur_pile(tableau[i_src][j_src-1])==0 && longueur_pile(tableau[i_src][j_src-2])==0)){
+    if (i_dest==i_src+1 || i_dest==i_src-1) return 1;
   }
   return 0;
 }
 
-void effectuer(pile **tableau,int i_src,int j_src, int i_dest,int j_dest,int nb)
+void effectuer(pile **tableau,int i_src,int j_src, int i_dest,int j_dest,int nb,int tour)
 {
   pile p;
   int i;
   for (i=0 ; i<nb ; i++){
     empiler(&p,depiler(tableau[i_src]+j_src));
   }
-  reset(tableau[i_dest]+j_dest);
+  if (sommet(tableau[i_dest][j_dest])[0]=="BN"[tour%2+1])
+    reset(tableau[i_dest]+j_dest);
   for (i=0 ; i<nb ; i++){
     empiler(tableau[i_dest]+j_dest,depiler(&p));
   }
diff --git a/src/deplacement.h b/src/deplacement.h
index 2e021c47e9e479ccf6c407ae624cd6fc7d692843..00349c853efdd092c2120cd090e611652dd97374 100644
--- a/src/deplacement.h
+++ b/src/deplacement.h
@@ -71,5 +71,5 @@ int cavaliers(pile ** tableau,int i_src,int j_src,int i_dest,int j_dest);
  * @assign
  * @ensure : effectue le déplacement d'une pile de pion d'une case vers une autre
  */
-void effectuer(pile **tableau,int i_src, int j_src,int i_dest, int j_dest,int nb);
+void effectuer(pile **tableau,int i_src, int j_src,int i_dest, int j_dest,int nb,int tour);
 #endif
diff --git a/src/main.c b/src/main.c
index 248cf5218519fa0d3b1b4902f03ebf4e46b5fcc5..d8b4aa8dd1f1c3b93a6b4ef15b52422402415ddf 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,6 +1,7 @@
 #include"tableau.h"
 #include"affichage.h"
 #include"action.h"
+#include"deplacement.h"
 /*main.c*/
 
 
@@ -15,7 +16,7 @@ int main(int argc, char **argv)
   char action;
   int tour=0;
   char sel[4]="\0\0\0\0";
-  while (1){ 
+  while (! partie_finie(tableau, N,tour)){ 
     affichage(tableau,N,sel,tour,"Entrez une action (c,d,a) >");
     scanf("%c",&action);
     realiser(action,tableau,N,sel,&tour);
diff --git a/src/tableau.c b/src/tableau.c
index a7eef0b870443b5c73f0595661a588d8315bf8c5..3c308f0836c845ed87a62047087e362315d4c5f1 100644
--- a/src/tableau.c
+++ b/src/tableau.c
@@ -122,3 +122,16 @@ int nb_de_pion(pile p,char couleur)
   }
   return i;
 }
+
+int partie_finie(pile ** tableau,int N,int tour)
+{
+  int i,j,k=0;
+  for (i=0 ; i<N ; i++)
+    for (j=0; j<N ; j++)
+      if (nb_de_pion(tableau[i][j],"BN"[tour%2+1])==0) k++;
+  if (k==2*N){
+    printf("La partie est finie");
+    return 1;
+  }
+  return 0;
+}
\ No newline at end of file
diff --git a/src/tableau.h b/src/tableau.h
index 1a642d9e67beddd2c583194cb6fd01b29bf237ee..85993603595529c7573f9a9361df1aac124ed741 100644
--- a/src/tableau.h
+++ b/src/tableau.h
@@ -94,5 +94,12 @@ void determiner_indices(char *sel,int N,int *i,int *j);
  * @ensure retourne le nombre de pion d'une couleur donnée placés sur le haut de la pile/case
  */
 int nb_de_pion(pile p,char couleur);
+
+/*
+ * @require
+ * @assign
+ * @ensure retourne 1 si la partie est finie, 0 sinon
+ */
+int partie_finie(pile ** tableau, int N,int tour);
 #endif 
 
diff --git a/stackchess b/stackchess
index 0816eaf67adcc40d16e83698ecf7e762bb6316e5..ef37a891f0b869551dd442a5dfcbdc3150025051 100755
Binary files a/stackchess and b/stackchess differ