diff options
Diffstat (limited to 'partition.c')
| -rw-r--r-- | partition.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/partition.c b/partition.c index 354e033..b7229d6 100644 --- a/partition.c +++ b/partition.c @@ -1,4 +1,5 @@ #include <stdlib.h> +#include <stdio.h> #include "sysfatal.h" #include "balls.h" @@ -52,6 +53,19 @@ freePartition(Partition part) { free(part.cells); } +void +printPartition(Partition part) { + size_t i, j; + + for (i = 0; i < part.size; i++) { + printf("{"); + for (j = 0; j < part.cells[i].size; j++) + printf("(%lu, %lu), ", part.cells[i].ballIndices[j][0], + part.cells[i].ballIndices[j][1]); + printf("}\n"); + } +} + /* Allocate an empty partition. Partition should be freed by the caller after use. */ static Partition newPartition(void) { |