Exemple #1
0
 public void render(TwentyGrid grid, int score)
 {
     byte[] newBuffer = new byte[280];
     for (int row = 0; row < 4; row++) {
         Array rowVals = grid.getRow (row);
         for (int col = 0; col < 4; col++) {
             int offset = row * 20 + col * 5;
             GetBytes (rowVals.GetValue (col)).CopyTo(newBuffer, offset);
         }
     }
     buf.Write (newBuffer, 0, 260);
 }
Exemple #2
0
 public void render(TwentyGrid grid, int score)
 {
     byte[] newBuffer = new byte[280];
     for (int row = 0; row < 4; row++)
     {
         Array rowVals = grid.getRow(row);
         for (int col = 0; col < 4; col++)
         {
             int offset = row * 20 + col * 5;
             GetBytes(rowVals.GetValue(col)).CopyTo(newBuffer, offset);
         }
     }
     buf.Write(newBuffer, 0, 260);
 }
Exemple #3
0
        private void hcondense(int dir)
        {
            bool modified = false;

            for (int row = 0; row < 4; row++)
            {
                Array newRow = logic(grid.getRow(row), dir);
                if (newRow != null)
                {
                    grid.setRow(row, newRow);
                    modified = true;
                }
            }
            if (modified)
            {
                postCondense();
            }
        }