abstract bfs
remove totalSwitch
simplify getLevelNum
test getLevelNum
remove loop