factor out numWalls, numApples, etc.
fix merge