 # dungeon entrance

Team

I started looked at the Dungeon problem specifically the first step for nominating starting locations for monster, door and player. Code I used was:

```CELLS = [(0, 0), (1, 0), (2, 0), (3, 0), (4, 0),
(0, 1), (1, 1), (2, 1), (3, 1), (4, 1),
(0, 2), (1, 2), (2, 2), (3, 2), (4, 2),
(0, 3), (1, 3), (2, 3), (3, 3), (4, 3),
(0, 4), (1, 4), (2, 4), (3, 4), (4, 4)]

def get_locations(location):
monster = None
door = None
player = None
for i in location:
monster = random.sample(location, k=1)
while door == monster:
door = random.sample(location, k=1)
else:
door = random.sample(location, k=1)
while player == monster or player == door:
player = random.sample(location, k=1)
else:
player = random.sample(location, k=1)
print(monster, door, player)

get_locations(CELLS)
```

To locate monster I really just had a stab based on earlier exercises and I don't really know why it has worked. How does the following part actually work? Is I effectively iterating through location and then stopping at some random point?

```    for i in location:
monster = random.sample(location, k=1)
```

Many thanks 