facebookresearch / off-belief-learning
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 811 units with 8,672 lines of code in units (65.1% of code).
    • 1 very complex units (163 lines of code)
    • 1 complex units (115 lines of code)
    • 16 medium complex units (909 lines of code)
    • 51 simple units (1,768 lines of code)
    • 742 very simple units (5,717 lines of code)
1% | 1% | 10% | 20% | 65%
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
py3% | 2% | 6% | 21% | 66%
cc0% | 0% | 18% | 21% | 60%
h0% | 0% | 5% | 14% | 80%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
pyhanabi/tools13% | 9% | 21% | 16% | 39%
hanabi-learning-environment/hanabi_lib0% | 0% | 23% | 21% | 54%
rlcc0% | 0% | 30% | 20% | 48%
pyhanabi/common_utils0% | 0% | 10% | 5% | 83%
pyhanabi0% | 0% | 0% | 25% | 74%
hanabi-learning-environment0% | 0% | 0% | 16% | 83%
rela0% | 0% | 0% | 23% | 76%
hanabi-learning-environment/agents/rainbow0% | 0% | 0% | 20% | 79%
hanabi-learning-environment/agents0% | 0% | 0% | 65% | 34%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def extract_game()
in pyhanabi/tools/extract_human_data.py
163 57 2
def parse_new_log()
in pyhanabi/tools/parse_log.py
115 36 2
def filter_game()
in pyhanabi/tools/run_human_game.py
40 25 3
cc
int EncodeLastAction_()
in hanabi-learning-environment/hanabi_lib/canonical_encoders.cc
98 24 7
cc
void R2D2Actor::act()
in rlcc/r2d2_actor.cc
90 20 2
virtual void mainLoop()
in rlcc/thread_loop.h
56 19 0
cc
bool HanabiState::MoveIsLegal()
in hanabi-learning-environment/hanabi_lib/hanabi_state.cc
54 15 1
def save()
in pyhanabi/common_utils/saver.py
36 14 6
def export_game()
in pyhanabi/tools/game_exporter.py
36 14 2
def parse_from_root()
in pyhanabi/tools/parse_log.py
36 14 6
def run_game()
in pyhanabi/tools/run_game.py
64 14 4
cc
void DataGenLoop::mainLoop()
in rlcc/clone_data_generator.cc
69 14 0
cc
int EncodeCardKnowledge()
in hanabi-learning-environment/hanabi_lib/canonical_encoders.cc
58 13 7
cc
int EncodeV0Belief_()
in hanabi-learning-environment/hanabi_lib/canonical_encoders.cc
86 12 9
cc
void R2D2Actor::reset()
in rlcc/r2d2_actor.cc
42 12 1
cc
void HanabiState::ApplyMove()
in hanabi-learning-environment/hanabi_lib/hanabi_state.cc
61 11 1
def average_across_seed()
in pyhanabi/tools/parse_log.py
29 11 1
def run_game()
in pyhanabi/tools/run_human_game.py
54 11 3
cc
int EncodeHands()
in hanabi-learning-environment/hanabi_lib/canonical_encoders.cc
57 10 8
cc
std::vector ComputeCardCount()
in hanabi-learning-environment/hanabi_lib/canonical_encoders.cc
43 10 5