Containers
This practical we're going to use containers to better store our agent coordinates, we'll still end with a lot of code, but we'll sort that out in the next practical; putting our agents in containers is the foundation. We'll also look at some neat functions for working with numbers in containers.
Our sequence this practical will be:
- shift our coordinates into lists;
- do some analysis on our coordinates;
First up, make sure you take a backup copy of last practical's code. How did you do with randomizing the starting locations? Here's one solution for the first coordinates...
y0 = random.randint(0,99)
x0 = random.randint(0,99)