Yes, thank you very much, it worked perfectly. Another question: In the notebook, it hints that for dead agents, their coordinates should all (x, y, and z) be set to -1. This seems like a mistake, throwing away information. I have only set the z coordinate to -1 for agents which reach the surface, and then mark them as dead.
Good question, as the wording in the notebook is a bit confusing. The coordinates for dead agents should be their final position and turn. Agents that do not die should have their turn marked as -1 at the end of the simulation. The process you describe is correct.