Commits

Anonymous committed e733d4e

Glue more than one

Comments (0)

Files changed (2)

 Bugs
 ====
 
-* `glue` don't work if there are more than one empty column
-
+* Message location is fixed
     return 1;
 }
 
-function glue_cols() {
+function one_glue() {
+    var moved = 0;
     for (var col = 1; col < NUM_COLS -1; ++col) {
         if (is_empty_col(col)) {
             for (var row = 0; row < NUM_ROWS; ++row) {
+                moved = (cell_color(row, col + 1) != BLANK);
                 cell_color(row, col, cell_color(row, col + 1));
                 cell_color(row, col + 1, BLANK);
             }
         }
     }
+
+    return moved;
+}
+
+function glue_cols() {
+    while (one_glue()) {
+        ;
+    }
 }
 
 function is_end_of_game() {