import collections


def __units_seen(states, army_type):
    """Identifies units seen, adding to dictionary in the order seen

        Args:
            states (list):          list of game states.
            army_type (string):     "Commanding" or "Opposing".
        
        Returns:
            Dictionary: { unit_id : step_when_seen } <int> : <int>
    """
    units_seen_dict = collections.OrderedDict()
    for state in states:
        for unit in state['Armies'][army_type]:
            if not unit in units_seen_dict.keys():
                units_seen_dict[unit] = state['Step']

    return units_seen_dict