Matrix traverseList(State state) { var mtx = state.mtx, queue = state.queue; while (queue.length() != 0) { traverseLevel(state); state.x++; } return mtx; }