microsoft / TextWorld
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 1,021 units with 8,289 lines of code in units (78.6% of code).
    • 2 very complex units (451 lines of code)
    • 3 complex units (228 lines of code)
    • 21 medium complex units (689 lines of code)
    • 92 simple units (1,963 lines of code)
    • 903 very simple units (4,958 lines of code)
5% | 2% | 8% | 23% | 59%
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
py5% | 2% | 8% | 22% | 60%
c0% | 0% | 0% | 74% | 25%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
textworld/challenges34% | 0% | 9% | 39% | 16%
textworld/render22% | 0% | 0% | 41% | 35%
textworld/generator0% | 7% | 13% | 26% | 53%
textworld/envs0% | 0% | 9% | 18% | 72%
textworld/logic0% | 0% | 4% | 4% | 90%
scripts0% | 0% | 18% | 0% | 81%
textworld0% | 0% | 0% | 24% | 75%
src0% | 0% | 0% | 74% | 25%
textworld/gym0% | 0% | 0% | 33% | 66%
benchmark0% | 0% | 0% | 22% | 77%
textworld/agents0% | 0% | 0% | 21% | 78%
textworld/textgen0% | 0% | 0% | 0% | 100%
ROOT0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def make()
in textworld/challenges/tw_cooking/cooking.py
319 116 3
def load_state()
in textworld/render/render.py
132 58 6
def populate_room()
in textworld/generator/world.py
77 40 6
def assign_description_to_room()
in textworld/generator/text_generation.py
102 37 3
def populate_room_with()
in textworld/generator/world.py
49 27 4
def generate_instruction()
in textworld/generator/text_generation.py
58 23 4
def _process_rooms()
in textworld/generator/world.py
48 21 1
def make_game()
in textworld/challenges/tw_coin_collector/coin_collector.py
58 18 2
def generate_text_from_grammar()
in textworld/generator/text_generation.py
23 18 2
def gen_source()
in textworld/generator/inform7/world2inform7.py
36 14 2
def generate_name()
in textworld/generator/text_grammar.py
39 14 5
def backtrack()
in textworld/generator/chaining.py
30 13 2
def update()
in textworld/generator/game.py
13 13 3
def _gather_infos()
in textworld/envs/tw.py
40 12 1
def _gather_infos()
in textworld/envs/wrappers/tw_inform7.py
32 12 1
def check_action()
in textworld/generator/chaining.py
22 12 4
def compile_inform7_game()
in textworld/generator/inform7/world2inform7.py
56 12 3
def set_walkthrough()
in textworld/generator/maker.py
23 12 2
def __init__()
in textworld/generator/vtypes.py
11 12 2
def _all_assignments()
in textworld/logic/__init__.py
33 12 8