diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index ba6656cb0f2e35c713d37d1efbac3074f280ebf0..0481dd8cad78a2f2bb50882dc83fde4b24313750 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,11 +4,15 @@
     <list default="true" id="a1e637b1-c555-4557-a6ba-8dfbc46c2cef" name="Default Changelist" comment="">
       <change beforePath="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
+<<<<<<< HEAD
       <change beforePath="$PROJECT_DIR$/game2048/.pytest_cache/v/cache/lastfailed" beforeDir="false" afterPath="$PROJECT_DIR$/game2048/.pytest_cache/v/cache/lastfailed" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/game2048/.pytest_cache/v/cache/nodeids" beforeDir="false" afterPath="$PROJECT_DIR$/game2048/.pytest_cache/v/cache/nodeids" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/game2048/grid_2048.py" beforeDir="false" afterPath="$PROJECT_DIR$/game2048/grid_2048.py" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/game2048/test_grid_2048.py" beforeDir="false" afterPath="$PROJECT_DIR$/game2048/test_grid_2048.py" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/game2048/textual_2048.py" beforeDir="false" afterPath="$PROJECT_DIR$/game2048/textual_2048.py" afterDir="false" />
+=======
+      <change beforePath="$PROJECT_DIR$/game2048/grid_2048.py" beforeDir="false" afterPath="$PROJECT_DIR$/game2048/grid_2048.py" afterDir="false" />
+>>>>>>> 952d2fcf3d0f6c682a4b8680a958de165afc17ae
     </list>
     <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
     <option name="SHOW_DIALOG" value="false" />
@@ -49,12 +53,44 @@
         </counts>
       </usages-collector>
     </session>
+    <session id="-897679322">
+      <usages-collector id="statistics.lifecycle.project">
+        <counts>
+          <entry key="project.closed" value="1" />
+          <entry key="project.open.time.6" value="1" />
+          <entry key="project.open.time.7" value="1" />
+          <entry key="project.opened" value="2" />
+        </counts>
+      </usages-collector>
+      <usages-collector id="statistics.file.extensions.open">
+        <counts>
+          <entry key="py" value="2" />
+        </counts>
+      </usages-collector>
+      <usages-collector id="statistics.file.types.open">
+        <counts>
+          <entry key="Python" value="2" />
+        </counts>
+      </usages-collector>
+      <usages-collector id="statistics.file.extensions.edit">
+        <counts>
+          <entry key="Python Console" value="38" />
+          <entry key="py" value="1757" />
+        </counts>
+      </usages-collector>
+      <usages-collector id="statistics.file.types.edit">
+        <counts>
+          <entry key="Python" value="1795" />
+        </counts>
+      </usages-collector>
+    </session>
   </component>
   <component name="FileEditorManager">
     <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
       <file pinned="false" current-in-tab="true">
         <entry file="file://$PROJECT_DIR$/game2048/grid_2048.py">
           <provider selected="true" editor-type-id="text-editor">
+<<<<<<< HEAD
             <state relative-caret-position="219">
               <caret line="87" column="43" selection-start-line="87" selection-start-column="43" selection-end-line="87" selection-end-column="43" />
               <folding>
@@ -71,11 +107,27 @@
               <caret line="64" lean-forward="true" selection-start-line="64" selection-end-line="64" />
               <folding>
                 <element signature="e#0#32#0" expanded="true" />
+=======
+            <state relative-caret-position="349">
+              <caret line="126" column="34" selection-start-line="126" selection-start-column="34" selection-end-line="126" selection-end-column="34" />
+              <folding>
+                <marker date="1542184310612" expanded="true" signature="3334:3339" ph="..." />
+>>>>>>> 952d2fcf3d0f6c682a4b8680a958de165afc17ae
               </folding>
             </state>
           </provider>
         </entry>
       </file>
+      <file pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/game2048/textual_2048.py">
+          <provider selected="true" editor-type-id="text-editor" />
+        </entry>
+      </file>
+      <file pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/game2048/test_textual_2048.py">
+          <provider selected="true" editor-type-id="text-editor" />
+        </entry>
+      </file>
     </leaf>
   </component>
   <component name="FileTemplateManagerImpl">
@@ -91,18 +143,23 @@
   <component name="IdeDocumentHistory">
     <option name="CHANGED_PATHS">
       <list>
+<<<<<<< HEAD
         <option value="$PROJECT_DIR$/game2048/textual2048.py" />
         <option value="$PROJECT_DIR$/game2048/test_textual_2048.py" />
         <option value="$PROJECT_DIR$/game2048/textual_2048.py" />
         <option value="$PROJECT_DIR$/game2048/test_grid_2048.py" />
+=======
+        <option value="$PROJECT_DIR$/game2048/textual_2048.py" />
+        <option value="$PROJECT_DIR$/game2048/test_textual_2048.py" />
+>>>>>>> 952d2fcf3d0f6c682a4b8680a958de165afc17ae
         <option value="$PROJECT_DIR$/game2048/grid_2048.py" />
       </list>
     </option>
   </component>
-  <component name="ProjectFrameBounds" extendedState="6">
-    <option name="x" value="1056" />
-    <option name="width" value="756" />
-    <option name="height" value="1032" />
+  <component name="ProjectFrameBounds">
+    <option name="x" value="1069" />
+    <option name="width" value="1085" />
+    <option name="height" value="1391" />
   </component>
   <component name="ProjectLevelVcsManager">
     <ConfirmationsSetting value="2" id="Add" />
@@ -132,7 +189,7 @@
     </panes>
   </component>
   <component name="PropertiesComponent">
-    <property name="last_opened_file_path" value="$PROJECT_DIR$" />
+    <property name="last_opened_file_path" value="$PROJECT_DIR$/../2048 local" />
     <property name="settings.editor.selected.configurable" value="com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable" />
   </component>
   <component name="RunDashboard">
@@ -147,16 +204,28 @@
       </list>
     </option>
   </component>
+<<<<<<< HEAD
   <component name="RunManager" selected="Python tests.pytest for test_grid_2048.test_create_grid">
     <configuration name="pytest for test_grid_2048.test_create_grid" type="tests" factoryName="py.test" temporary="true" nameIsGenerated="true">
       <module name="2048" />
       <option name="INTERPRETER_OPTIONS" value="" />
       <option name="PARENT_ENVS" value="true" />
+=======
+  <component name="RunManager">
+    <configuration name="grid_2048" type="PythonConfigurationType" factoryName="Python" temporary="true">
+      <module name="2048" />
+      <option name="INTERPRETER_OPTIONS" value="" />
+      <option name="PARENT_ENVS" value="true" />
+      <envs>
+        <env name="PYTHONUNBUFFERED" value="1" />
+      </envs>
+>>>>>>> 952d2fcf3d0f6c682a4b8680a958de165afc17ae
       <option name="SDK_HOME" value="" />
       <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/game2048" />
       <option name="IS_MODULE_SDK" value="true" />
       <option name="ADD_CONTENT_ROOTS" value="true" />
       <option name="ADD_SOURCE_ROOTS" value="true" />
+<<<<<<< HEAD
       <option name="_new_keywords" value="&quot;&quot;" />
       <option name="_new_additionalArguments" value="&quot;&quot;" />
       <option name="_new_target" value="&quot;test_grid_2048.test_create_grid&quot;" />
@@ -203,6 +272,20 @@
         <item itemvalue="Python tests.pytest for test_grid_2048.test_create_grid" />
         <item itemvalue="Python tests.pytest in test_grid_2048.py" />
         <item itemvalue="Python tests.pytest for test_grid_2048.test_move_row_left" />
+=======
+      <option name="SCRIPT_NAME" value="$PROJECT_DIR$/game2048/grid_2048.py" />
+      <option name="PARAMETERS" value="" />
+      <option name="SHOW_COMMAND_LINE" value="false" />
+      <option name="EMULATE_TERMINAL" value="false" />
+      <option name="MODULE_MODE" value="false" />
+      <option name="REDIRECT_INPUT" value="false" />
+      <option name="INPUT_FILE" value="" />
+      <method v="2" />
+    </configuration>
+    <recent_temporary>
+      <list>
+        <item itemvalue="Python.grid_2048" />
+>>>>>>> 952d2fcf3d0f6c682a4b8680a958de165afc17ae
       </list>
     </recent_temporary>
   </component>
@@ -227,20 +310,28 @@
     </history-entry>
   </component>
   <component name="ToolWindowManager">
-    <frame x="-7" y="-7" width="1295" height="695" extended-state="6" />
+    <frame x="713" y="0" width="723" height="927" extended-state="0" />
     <editor active="true" />
     <layout>
-      <window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.24960254" />
+      <window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.12244898" />
       <window_info id="Structure" order="1" weight="0.25" />
       <window_info anchor="bottom" id="Message" order="0" />
       <window_info anchor="bottom" id="Find" order="1" />
+<<<<<<< HEAD
       <window_info anchor="bottom" id="Run" order="2" visible="true" weight="0.2605753" />
+=======
+      <window_info active="true" anchor="bottom" id="Run" order="2" visible="true" weight="0.32955974" />
+>>>>>>> 952d2fcf3d0f6c682a4b8680a958de165afc17ae
       <window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
       <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
       <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
       <window_info anchor="bottom" id="TODO" order="6" />
       <window_info anchor="bottom" id="Version Control" order="7" />
+<<<<<<< HEAD
       <window_info anchor="bottom" id="Python Console" order="8" />
+=======
+      <window_info anchor="bottom" id="Python Console" order="8" weight="0.32955974" />
+>>>>>>> 952d2fcf3d0f6c682a4b8680a958de165afc17ae
       <window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
       <window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
       <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
@@ -288,13 +379,26 @@
     </entry>
     <entry file="file://$PROJECT_DIR$/game2048/grid_2048.py">
       <provider selected="true" editor-type-id="text-editor">
+<<<<<<< HEAD
         <state relative-caret-position="219">
           <caret line="87" column="43" selection-start-line="87" selection-start-column="43" selection-end-line="87" selection-end-column="43" />
           <folding>
             <marker date="1542184553928" expanded="true" signature="2609:2611" ph="..." />
+=======
+        <state relative-caret-position="349">
+          <caret line="126" column="34" selection-start-line="126" selection-start-column="34" selection-end-line="126" selection-end-column="34" />
+          <folding>
+            <marker date="1542184310612" expanded="true" signature="3334:3339" ph="..." />
+>>>>>>> 952d2fcf3d0f6c682a4b8680a958de165afc17ae
           </folding>
         </state>
       </provider>
     </entry>
+    <entry file="file://$PROJECT_DIR$/game2048/textual_2048.py">
+      <provider selected="true" editor-type-id="text-editor" />
+    </entry>
+    <entry file="file://$PROJECT_DIR$/game2048/test_textual_2048.py">
+      <provider selected="true" editor-type-id="text-editor" />
+    </entry>
   </component>
 </project>
\ No newline at end of file
diff --git a/game2048/grid_2048.py b/game2048/grid_2048.py
index 97f5e1c23f5cd79ba836f612efb0325ba48f598c..9cb660b1e28b04ea6d1aa08eb0e9943b5dc98992 100644
--- a/game2048/grid_2048.py
+++ b/game2048/grid_2048.py
@@ -2,67 +2,96 @@ import random as rd
 
 THEMES = {"0": {"name": "Default", 0: "", 2: "2", 4: "4", 8: "8", 16: "16", 32:"32", 64: "64", 128: "128", 256: "256", 512: "512", 1024: "1024", 2048: "2048",4096: "4096", 8192: "8192"}, "1": {"name": "Chemistry", 0: "", 2: "H", 4: "He", 8:"Li", 16: "Be", 32: "B", 64: "C", 128: "N", 256: "O", 512: "F", 1024: "Ne", 2048:"Na", 4096: "Mg", 8192: "Al"}, "2": {"name": "Alphabet", 0: "", 2: "A", 4: "B", 8:"C", 16: "D", 32: "E", 64: "F", 128: "G", 256: "H", 512: "I", 1024: "J", 2048: "K",4096: "L", 8192: "M"}}
 
+#FONCTIONNALITE 1
+
 def create_grid(n):
     game_grid = []
     for i in range(n):
-        game_grid.append([' ']*n)
-    return game_grid
+        #crée le bon nombre de ligne
+        game_grid.append([' ']*n) #crée le bon nombre de colonnes
+    return (game_grid)
+
 
 def get_value_new_tile():
+    #choisi la valeur de la nouvelle case avec la probabilté indiquée dans l'énoncé
     return rd.choice([2,2,2,2,2,2,2,2,2,4])
 
 def get_all_tiles(grid):
     tiles = []
-    for line in grid:
-        for tile in line:
-            if tile == ' ': tiles.append(0)
+    for line in grid: #parcours toutes les lignes
+        for tile in line: #parcours toutes les colonnes
+            if tile == ' ': tiles.append(0) #traite le cas particulier de la double notation 0 ou " " pour les emplacments vides
             else: tiles.append(tile)
     return tiles
 
+
 def get_empty_tiles_positions(grid):
     empty_tiles = []
-    n = len(grid)
-    m = len(grid[0])
-    for i in range(n):
-        for j in range(m):
+    nb_ligne = len(grid)
+    nb_colonne = len(grid[0])
+    #on suppose que la grille a au moins une ligne
+    #on suppose que toutes les lignes ont le même nombre de colonnes
+
+    for i in range(nb_ligne):
+        for j in range(nb_colonne):
+
             if grid[i][j] == ' ' or grid[i][j] == 0:
+            #traite le cas particulier de la double notation 0 ou " " pour les emplacments vides
                 empty_tiles.append((i,j))
     return empty_tiles
 
+
 def get_new_position(grid):
+    #choisi une postion au hasard parmis les position libre
     empty_tiles = get_empty_tiles_positions(grid)
-    return rd.choice(empty_tiles)
+    return (rd.choice(empty_tiles))
 
 def grid_get_value(grid,x,y):
     if grid[x][y] == ' ':
+        #traite le cas particulier de la double notation 0 ou " "
         return 0
     return grid[x][y]
 
 def grid_add_new_tile(grid):
     x,y = get_new_position(grid)
     grid[x][y] = get_value_new_tile()
+    #attention, la fonction modifie la liste passée en argument !
     return grid
 
 def init_game(n):
     grid = create_grid(n)
-    for i in range(2):
+    for new_tile in range(2):
         grid = grid_add_new_tile(grid)
     return grid
 
+
+#FONCTIONNALITE 2
+
 def grid_to_string_with_size_and_theme(grid, theme,n):
-    m = long_value_with_theme(grid,theme)
-    a = ""
-    for i in range(n):
-        a += (" " + "="*(m+2))*n + "\n"
-        for j in range(n):
-            a += "| {}".format(theme[grid[i][j]]) + " "*(1 + m - len(theme[grid[i][j]]))
-        a += "|\n"
-    a += (" " + "="*(m+2))*n
-    return a
+    longest_str = long_value_with_theme(grid,theme)
+    affichage = ""
+    for ligne in range(n):
+
+        #création de la délimation du dessus
+        affichage += (" " + "="*(longest_str+2))*n + "\n"
+        #calcul du nombre nécéssaire d'espaces
+
+        for colonne in range(n):
+            affichage += "| {}".format(theme[grid[ligne][colonne]]) + " "*(1 + longest_str - len(theme[grid[ligne][colonne]]))
+        affichage += "|\n" #fini la ligne
+
+    #création de la dernière délimation du bas
+    affichage += (" " + "="*(longest_str+2))*n
+    return affichage
 
 def long_value_with_theme(grid,theme):
     return max(len(theme[v]) for v in get_all_tiles(grid))
 
+<<<<<<< HEAD
+
+
+#FONCTIONNALITE 4
+
 def del_zeros(row):
     n = len(row)
     new_row = []
@@ -86,5 +115,3 @@ def move_row_left(row):
     row,n = del_zeros(row)
     new_row = move_left_bis(row)
     return new_row + [0]*(n - len(new_row))
-
-