getTile() {
let topics = this.topics.slice(0)
let tile = []
let types = ['double', 'triple', 'triple-left', 'triple-right']
let regularity = [0,1,2,0,1,3]
let i = 0 // regularity iterator
let obj
while(topics.length) {
let type = types[regularity[i]]
switch(type) {
case 'double':
obj = resetObj(type)
obj.array.push(topics.shift())
obj.array.push(topics.shift())
tile.push(obj)
break
case 'triple':
obj = resetObj(type)
obj.array.push(topics.shift())
obj.array.push(topics.shift())
obj.array.push(topics.shift())
tile.push(obj)
break
case 'triple-left':
obj = resetObj(type)
obj.array.push(topics.shift())
obj.array.push(topics.shift())
obj.array.push(topics.shift())
tile.push(obj)
break
case 'triple-right':
obj = resetObj(type)
obj.array.push(topics.shift())
obj.array.push(topics.shift())
obj.array.push(topics.shift())
tile.push(obj)
break
}
// reset regularity iterator
if (i === 5) {
i = 0
} else {
i++
}
function resetObj(type) {
return {
type,
array: []
}
}
}
return tile
}