From 767789458c481ae49fc47c33ea406ba26f3909ac Mon Sep 17 00:00:00 2001 From: kleph Date: Thu, 12 May 2016 23:37:02 +0200 Subject: [PATCH] [cleanup] remove useless conditions --- 02_dynamic_bsp_rooms.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/02_dynamic_bsp_rooms.py b/02_dynamic_bsp_rooms.py index d329068..40faa14 100644 --- a/02_dynamic_bsp_rooms.py +++ b/02_dynamic_bsp_rooms.py @@ -114,19 +114,13 @@ class Room: def generate_tree(): # init tree tree = [Leaf(0, 0, 30, 30, 0)] - # tree = [Leaf(0, 0, 10, 10, 0)] - # tree = [Leaf(0, 0, 5, 5, 0)] # split leaves until none succeed - split_done = True - while split_done: - split_done = False - for l in tree: - if not l.left_leaf and not l.right_leaf: - if l.split(): - tree.append(l.left_leaf) - tree.append(l.right_leaf) - split_done = True + # Lists are ordered. Tree will be created and travel from left to right + for l in tree: + if l.split(): + tree.append(l.left_leaf) + tree.append(l.right_leaf) # create rooms from partitions tree[0].generate_rooms() @@ -166,6 +160,7 @@ def on_draw(): label.draw() + def draw_tree(t): """ :param t: each leave of t will be draw()