getGrandchilds method

List<Tile> getGrandchilds()

Returns the grandchild-tiles. The tiles are ordered by row, then column meaning the first 4 tiles are the upper row from left to right.

Implementation

List<Tile> getGrandchilds() {
  List<Tile> childs = getChilds();
  List<Tile> result = [];
  for (int i = 0; i < 2; ++i) {
    List<Tile> result0 = [];
    List<Tile> result1 = [];
    List<Tile> grand = childs[i * 2].getChilds();
    result0.add(grand[0]);
    result0.add(grand[1]);
    result1.add(grand[2]);
    result1.add(grand[3]);
    grand = childs[i * 2 + 1].getChilds();
    result0.add(grand[0]);
    result0.add(grand[1]);
    result1.add(grand[2]);
    result1.add(grand[3]);

    result.addAll(result0);
    result.addAll(result1);
  }
  assert(result.length == 16);
  return result;
}