I am trying to make a program that generates two lists of entities that are intended to take turns attacking each other. For each loop, each entity in the list is meant to attack a random entity in the other list, and if an entity’s hp goes below zero, the entity is deleted. When all entities in the list have made an attack, it is the other list’s turn to do the same,. If a list becomes empty, the other list of entities is declared the victor. I am deeply confused on a few things:
- I am unsure of how to work with pointers so that a warrior weapon attacks a random orc, and vice versa. Do I need to select an entity from the other list, and then do what I need to do?
- I am sketchy on the syntax of creating the objects in each list, and making the objects interact. I know what I want to do, I just don’'t know how to do it precisely right.
Here is the project for examination. Any and all advice, guidance, etc. is greatly appreciated. I have posted here because googling lists and pointers hasn’t been too much help. These articles can show me what these things are, but they don’t show me how to use them together for what I need.