Mercurial > sypikslang
comparison gamelib/visualize.py @ 101:e92035dce1f6
pep8hg pushhg push
author | Rizmari Versfeld <rizziepit@gmail.com> |
---|---|
date | Wed, 09 May 2012 22:11:52 +0200 |
parents | b27b4dede626 |
children | 80fa87ac505e |
comparison
equal
deleted
inserted
replaced
100:b27b4dede626 | 101:e92035dce1f6 |
---|---|
13 rt = networkx.DiGraph() | 13 rt = networkx.DiGraph() |
14 for research in lab.new_research: | 14 for research in lab.new_research: |
15 rt.add_node(research, label=research.NAME, color='green') | 15 rt.add_node(research, label=research.NAME, color='green') |
16 for research in lab.new_research: | 16 for research in lab.new_research: |
17 for prereq in research.PREREQUISITES: | 17 for prereq in research.PREREQUISITES: |
18 rt.add_edge(prereq[0], research, weight=1.0/prereq[1], \ | 18 rt.add_edge(prereq[0], research, weight=1.0 / prereq[1], \ |
19 label=prereq[1], color='green') | 19 label=prereq[1], color='green') |
20 for schematic in lab.new_schematics: | 20 for schematic in lab.new_schematics: |
21 rt.add_node(schematic, label=schematic.NAME, color='red') | 21 rt.add_node(schematic, label=schematic.NAME, color='red') |
22 for schematic in lab.new_schematics: | 22 for schematic in lab.new_schematics: |
23 for prereq in schematic.PREREQUISITES: | 23 for prereq in schematic.PREREQUISITES: |
24 rt.add_edge(prereq[0], schematic, weight=1.0/prereq[1], \ | 24 rt.add_edge(prereq[0], schematic, weight=1.0 / prereq[1], \ |
25 label=prereq[1], color='red', size=schematic.COST/10) | 25 label=prereq[1], color='red', size=schematic.COST/10) |
26 return rt | 26 return rt |
27 | 27 |
28 | 28 |
29 def draw(rt): | 29 def draw(rt): |