Mercurial > baum
comparison actions.c @ 53:036779d5da75
"sum" node clears its value now everytime it gets called
author | meillo@marmaro.de |
---|---|
date | Sun, 02 Mar 2008 16:32:52 +0100 |
parents | 201b4603671a |
children | 6279e5b14d9e |
comparison
equal
deleted
inserted
replaced
52:201b4603671a | 53:036779d5da75 |
---|---|
62 } | 62 } |
63 | 63 |
64 | 64 |
65 unsigned char action_sum(struct Node* node) { | 65 unsigned char action_sum(struct Node* node) { |
66 struct Node* tp; | 66 struct Node* tp; |
67 | |
68 node->value = 0; | |
67 tp = node->down; | 69 tp = node->down; |
68 while (tp != NULL) { | 70 while (tp != NULL) { |
69 node->value += action(tp); | 71 node->value += action(tp); |
70 tp = tp->right; | 72 tp = tp->right; |
71 } | 73 } |
91 input = input % 256; | 93 input = input % 256; |
92 } else { | 94 } else { |
93 /* return value */ | 95 /* return value */ |
94 input = action(node->down); | 96 input = action(node->down); |
95 } | 97 } |
96 | |
97 insertLast(node, newNode("number", (char) input)); | 98 insertLast(node, newNode("number", (char) input)); |
98 return 0; | 99 return 0; |
99 } | 100 } |
100 | 101 |
101 | 102 |