facebookresearch / diplomacy_searchbot
Conditional Complexity

The distribution of complexity of units (measured with McCabe index).

Intro
  • Conditional complexity (also called cyclomatic complexity) is a term used to measure the complexity of software. The term refers to the number of possible paths through a program function. A higher value ofter means higher maintenance and testing costs (infosecinstitute.com).
  • Conditional complexity is calculated by counting all conditions in the program that can affect the execution path (e.g. if statement, loops, switches, and/or operators, try and catch blocks...).
  • Conditional complexity is measured at the unit level (methods, functions...).
  • Units are classified in four categories based on the measured McCabe index: 1-5 (simple units), 6-10 (medium complex units), 11-25 (complex units), 26+ (very complex units).
Learn more...
Conditional Complexity Overall
  • There are 867 units with 10,994 lines of code in units (16.1% of code).
    • 1 very complex units (163 lines of code)
    • 8 complex units (1,012 lines of code)
    • 40 medium complex units (2,102 lines of code)
    • 90 simple units (2,351 lines of code)
    • 728 very simple units (5,366 lines of code)
1% | 9% | 19% | 21% | 48%
Legend:
51+
26-50
11-25
6-10
1-5
Alternative Visuals
Conditional Complexity per Extension
51+
26-50
11-25
6-10
1-5
cc5% | 13% | 22% | 26% | 32%
py0% | 8% | 18% | 19% | 52%
h0% | 0% | 8% | 18% | 73%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
dipcc/dipcc4% | 11% | 22% | 25% | 35%
fairdiplomacy/selfplay0% | 7% | 11% | 21% | 58%
fairdiplomacy/models0% | 20% | 14% | 12% | 52%
fairdiplomacy/agents0% | 16% | 20% | 7% | 55%
heyhi0% | 7% | 26% | 10% | 54%
fairdiplomacy/data0% | 0% | 32% | 32% | 34%
fairdiplomacy/utils0% | 0% | 18% | 21% | 60%
fairdiplomacy0% | 0% | 21% | 23% | 55%
dipcc/python0% | 0% | 61% | 0% | 38%
conf/c02_sup_train0% | 0% | 0% | 77% | 22%
conf/exps0% | 0% | 0% | 92% | 7%
ROOT0% | 0% | 0% | 0% | 100%
slurm0% | 0% | 0% | 0% | 100%
integration_tests0% | 0% | 0% | 0% | 100%
dipcc0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
cc
GameState GameState::process_m()
in dipcc/dipcc/cc/adjudicator.cc
163 51 2
def main_subproc()
in fairdiplomacy/models/diplomacy_model/train_sl.py
165 39 6
def get_orders()
in fairdiplomacy/agents/ce1p_agent.py
162 34 3
def do_step_research()
in fairdiplomacy/selfplay/exploit.py
230 32 4
cc
bool _try_resolve_loc()
in dipcc/dipcc/cc/adjudicator.cc
105 30 3
cc
void GameState::load_all_possible_orders_m()
in dipcc/dipcc/cc/game_state.cc
103 30 0
cc
void encode_board_state()
in dipcc/dipcc/cc/encoding.cc
89 26 2
cc
void encode_prev_orders()
in dipcc/dipcc/cc/encoding.cc
100 26 2
58 26 3
cc
py::dict py_state_to_dict()
in dipcc/dipcc/pybind/py_dict.cc
88 24 1
def make_ratings_table()
in fairdiplomacy/data/build_metadata.py
72 23 1
def compute_nash_conv()
in fairdiplomacy/agents/searchbot_agent.py
60 21 5
cc
json GameState::to_json()
in dipcc/dipcc/cc/game_state.cc
64 20 0
def save_pandas_table()
in heyhi/gsheets.py
70 20 6
def get_datasets_from_cfg()
in fairdiplomacy/models/diplomacy_model/train_sl.py
68 19 1
def _assign_devices()
in fairdiplomacy/selfplay/search_data_loader.py
47 19 1
def set_phase_orders()
in fairdiplomacy/data/build_dataset.py
50 19 2
58 18 1
def run_situation_check()
in fairdiplomacy/situation_check.py
58 16 3
def _init_training_device_and_state()
in fairdiplomacy/selfplay/exploit.py
93 16 1