diff --git a/carreler.lua b/carreler.lua
index 5a797829ba909ca55ce4e9cc25f7689b92be69a8..b5525914eafc9bd1557ff3013be78da33e3e476f 100644
--- a/carreler.lua
+++ b/carreler.lua
@@ -33,12 +33,33 @@ end
 function carrelerLigne(m)
     for i=1,(m-1),1
     do
-        turtle.placeDown()
+        placerSous()
         turtle.forward()
     end
+    placerSous()
+end
+
+function placerSous()
+    replacerInventaire()
     turtle.placeDown()
 end
 
+function replacerInventaire()
+    slot = turtle.getSelectedSlot()
+    -- taille de l'inventaire d'une tortue: 16
+    while slot < 16
+    do
+        if ( turtle.getItemCount() == 0 )
+        then
+            slot = slot + 1
+            turtle.select(slot)
+        else
+            return true
+        end
+    end
+    return false
+end
+
 -- Lancer le programme
 main()