diff --git a/Makefile b/Makefile
index d3cdafe79193b58574ffc1e934bab278e90f16d2..21abdd6e600702976719de76dce7980469e3880c 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-CC=ocamlc
+CC=ocamlopt
 FLAGS=
 
 all: main.out
diff --git a/bin/main.out b/bin/main.out
index 853635e75b272ac6cd770ab0de447022d30cfe67..fc04ed99ca3cd776d3f03353cda79076af2ae29c 100755
Binary files a/bin/main.out and b/bin/main.out differ
diff --git a/src/.main.ml.swo b/src/.main.ml.swo
new file mode 100644
index 0000000000000000000000000000000000000000..b1b4e60b167324d7b344cb5de77ee61e4f144260
Binary files /dev/null and b/src/.main.ml.swo differ
diff --git a/src/main.cmi b/src/main.cmi
index 6cbabdbc13301f8aa24da602d401972daa8fbb0e..2db95aff844eaf7039eb18c9dbea3c5d665fd9c0 100644
Binary files a/src/main.cmi and b/src/main.cmi differ
diff --git a/src/main.cmx b/src/main.cmx
new file mode 100644
index 0000000000000000000000000000000000000000..5984df0393b355fe8ff75d560c0366b7ffeb88cc
Binary files /dev/null and b/src/main.cmx differ
diff --git a/src/main.ml b/src/main.ml
index 9b3d38ef13a18c23ac0a941087b2cd6f6f59657b..42c259a92ecd5e9dbf02f690de0e549345294515 100644
--- a/src/main.ml
+++ b/src/main.ml
@@ -33,27 +33,47 @@ print_elt 1 (parse_input());;*)
 (*définition de la roue*)
 let roue = ' '::'A'::'B'::'C'::'D'::'E'::'F'::'G'::'H'::'I'::'J'::'K'::'L'::'M'::'N'::'O'::'P'::'Q'::'R'::'S'::'T'::'U'::'V'::'W'::'X'::'Y'::'Z'::[];;
 
-(*[translate c] traduit le charactère c en sa commande
- * la limite d'optimalité pour choisir entre P et N est le charactère 'M' qui demande 13N et 14P*)
+(*[first_to_last c n roue] tourne la roue n fois vers la gauche si c='N' et vers la droite si c='P'*)
+exception RoueVide;;
+let rec tourner c n roue =
+    if n = 0 then roue 
+    else match roue with 
+        |[] -> raise RoueVide
+        |e::l -> if c='N' then (tourner 'N' (n-1) (List.concat (l::(e::[])::[]))) 
+        else if c='P' then List.rev (tourner 'N' n (List.rev roue))
+        else roue;;
+
+(*[char_to_index i a r] cherche récursivement l'indice du charactère a dans la roue r*)
 exception BadCharacter of char;;
-let translate c = 
-    (*[char_to_index i a r] cherche récursivement l'indice du charactère a dans la roue r*)
-    let rec char_to_index i a r= 
-        match r with 
-            | [] -> raise (BadCharacter a)
-            | e::l -> if a == e then i
-                      else char_to_index (i+1) a l  
-    in
-        let n = char_to_index 0 c roue in 
-             if (n < 14) then String.concat "" ((String.make n 'N')::"E"::[])
-             else String.concat "" ((String.make (27-n) 'P')::"E"::[]);;
-
-(*[commande (i,l)] prend le résultat de l'input et renvoie la commande complète associée'*)
-(*let commande (i,l) = List.fold_left (fun acc e -> (String.concat "" (acc::(translate e)::[]))) [] l;;*)
+let rec char_to_index i a r= 
+    match r with 
+        | [] -> raise (BadCharacter a)
+        | e::l -> if a = e then i
+                  else char_to_index (i+1) a l;;  
+
+(*[translate c roue] traduit le charactère c en sa commande en fonction de la roue 'roue'
+ * la limite d'optimalité pour choisir entre P et N est le charactère 'M' qui demande 13N et 14P*)
+let translate c roue = 
+    let n = char_to_index 0 c roue in 
+        if (n < 14) then String.concat "" ((String.make n 'N')::"E"::[]),n
+        else String.concat "" ((String.make (27-n) 'P')::"E"::[]),(27-n);;
+
+(*[commande (i,l) roue] prend le résultat de l'input et renvoie la commande complète associée'*)
 exception InputVide;;
-let rec commande (i,l) = match l with
+let rec commande (i,l) roue = match l with
     | [] -> ""
-    | e::r -> String.concat "" ((translate e)::(commande (i,r))::[]);;
+    | e::r -> let (c,n) = translate e roue in
+    String.concat "" (c::(commande (i,r) (tourner c.[0] n roue))::[]);;
+
 
+print_string (commande (parse_input()) roue);;
 
-print_string (commande (parse_input()));;
+let temps_lettre l = 
+    if (l='N' || l='P') then 3
+    else if l='S' then 1
+    else if l='E' then 5
+    else 0;;
+(*
+let temps_commande c = 
+    let liste = split_string c in 
+  *)       
diff --git a/src/main.o b/src/main.o
new file mode 100644
index 0000000000000000000000000000000000000000..2cad6bf53b82815a2b51a3b1df61243e5b7256a0
Binary files /dev/null and b/src/main.o differ