Army rallies aren't working correctly for me
When I used the latest code from https://github.com/skjb/pysc2-tutorial/blob/master/Building%20a%20Basic%20Agent/simple_agent.py, the first Marine would rally across the map alone. Then a few extra Marines would get built, but never attack. I fixed this by changing a single line:
elif obs.observation["player"][_SUPPLY_USED] == obs.observation["player"][_SUPPLY_MAX] and not self.army_rallied:
It's possible I have an error, but I can't see what it might be. Before I made the change, I noticed that the barracks often gets deselected, and Marines sometimes wouldn't build until I selected it manually. My understanding was/is that "train_marine_quick" should appear in obs.observation["available_actions"] even if the rax isn't selected. Is that correct?
It sounds like the issue is that your barracks are being deselected for some reason. You can only train marines when the barracks is selected. I would suggest continuing with the next few tutorials as they have ways to deal with deselection.