@@ -19,17 +19,22 @@ fn bottom_up_tree(item: int, depth: int) -> ~tree {
19
19
} else { ret ~nil; }
20
20
}
21
21
22
- fn main ( ) {
23
- let n = 8 ;
22
+ fn main ( args : [ str ] ) {
23
+ let n = if vec:: len ( args) == 2 u {
24
+ int:: from_str ( args[ 1 ] )
25
+ } else {
26
+ 15
27
+ } ;
24
28
let min_depth = 4 ;
25
29
let max_depth;
26
30
if min_depth + 2 > n {
27
31
max_depth = min_depth + 2 ;
28
32
} else { max_depth = n; }
29
33
let stretch_depth = max_depth + 1 ;
30
34
let stretch_tree = bottom_up_tree ( 0 , stretch_depth) ;
31
- #debug ( "stretch tree of depth %d\t check: %d" , stretch_depth,
32
- item_check ( stretch_tree) ) ;
35
+ std:: io:: println ( #fmt ( "stretch tree of depth %d\t check: %d" ,
36
+ stretch_depth,
37
+ item_check ( stretch_tree) ) ) ;
33
38
let long_lived_tree = bottom_up_tree ( 0 , max_depth) ;
34
39
let depth = min_depth;
35
40
while depth <= max_depth {
@@ -43,10 +48,12 @@ fn main() {
43
48
chk += item_check ( temp_tree) ;
44
49
i += 1 ;
45
50
}
46
- #debug ( "%d\t trees of depth %d\t check: %d" , iterations * 2 , depth,
47
- chk) ;
51
+ std:: io:: println ( #fmt ( "%d\t trees of depth %d\t check: %d" ,
52
+ iterations * 2 , depth,
53
+ chk) ) ;
48
54
depth += 2 ;
49
55
}
50
- #debug ( "long lived trees of depth %d\t check: %d" , max_depth,
51
- item_check ( long_lived_tree) ) ;
56
+ std:: io:: println ( #fmt ( "long lived trees of depth %d\t check: %d" ,
57
+ max_depth,
58
+ item_check ( long_lived_tree) ) ) ;
52
59
}
0 commit comments