return ret;
}
+int count (board_t *board, int id)
+{
+ int nb = 0;
+ int x, y;
+ for (x = 0; x < board->width; x++) {
+ for (y = 0; y < board->height; y++) {
+ if (*getcell (board, x, y) == '0' + id) {
+ nb++;
+ }
+ }
+ }
+ return nb;
+}
+
/* vim: set ts=4 sw=4 et: */
int find (board_t *board, int id);
+int count (board_t *board, int id);
+
#endif /* __FUNCTION_H__ */
/* vim: set ts=4 sw=4 et: */
#include <curses.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include "constant.h"
#include "debug.h"
}
/* message */
+ sprintf (msg + strlen (msg), " [%02d|%02d]", count (board, 0), count (board, 1));
msgwindow (msg, xmsg, ymsg, lmsg);
/* get key press */