Main Module

Unswaps minion name tags.

This module can be used as a library or as a program. For program usage, please run the program as shown:

python3.5 main.py --help
main.swap_nametags(acc, sw)

Creates a new ID/Name dict with swapped entries.

Creates a copy of acc and uses sw to swap the names in the copy. acc is not modified. Instead, this function returns a modified copy of acc.

Parameters:
Returns:

A copy of acc with names swapped according to sw

Return type:

dict

main.unswap(initial, swaps)

Unswap names according to initial state and swap data.

Follows a list of swapevent.SwapEvent s to determine the original mapping of minion IDs to names (i.e. their actual names).

The code in the body of this function should not be modified.

Parameters:
  • initial (dict) – A dict of the most recent mapping of minion IDs to names. The result of playing their game.
  • swaps (list of swapevent.SwapEvent) – The swaps that occurred to mess up the name/id mapping
Returns:

The original mapping of minion IDs to their name tags

Return type:

dict

main.load_and_unswap(state_file, swap_file)

Loads data from provided file paths and returns unswapped names.

The code in the body of this function should not be modified.

Parameters:
  • state_file (str) – Path to the file containing JSON-formatted ID/name data
  • swap_file (str) – Path to the file containing swap data
Returns:

A mapping of minion IDs to their actual names

Return type:

dict

main.main()

Configure CLI args and unswap data.