1. Shlomi Fish
  2. nurikabe

Commits

shl...@b384bcd7-cfd4-0310-aca0-d78b80f7b91b  committed 2f322ce

Added cell_mat.h which defines the internal API for the verdicts' matrix.

  • Participants
  • Parent commits dbfb68c
  • Branches default

Comments (0)

Files changed (3)

File nurikabe-solver/Makefile

View file
  • Ignore whitespace
-all:
+MODULES = cell_mat.c
+HEADERS = cell_mat.h
+
+CFLAGS = -g -Wall
+
+all: libnk-solve.so
+
+libnk-solve.so: $(MODULES) $(HEADERS)
+	gcc $(CFLAGS) -shared `pkg-config --cflags glib-2.0` -o $@ $(MODULES) `pkg-config --libs glib-2.0`
 
 test:
 	runprove t/*.t

File nurikabe-solver/cell_mat.c

View file
  • Ignore whitespace
+#include "cell_mat.h"
+

File nurikabe-solver/cell_mat.h

View file
  • Ignore whitespace
+#ifndef NK_SOLVE__VERDICT_MAT_H
+#define NK_SOLVE__VERDICT_MAT_H
+
+#include <glib.h>
+
+enum NK_SOLVE_VERDICT
+{
+    NK_SOLVE_VERDICT__UNKNOWN,
+    NK_SOLVE_VERDICT__WHITE,
+    NK_SOLVE_VERDICT__BLACK,
+};
+
+typedef enum 
+{
+    NK_SOLVE_ERROR__SUCCESS = 0,
+    NK_SOLVE_ERROR__ALLOC_FAILED,
+    NK_SOLVE_ERROR__X_OUT_OF_BOUNDS,
+    NK_SOLVE_ERROR__Y_OUT_OF_BOUNDS
+} NK_SOLVE_ERROR_CODE;
+
+typedef enum NK_SOLVE_VERDICT nk_solve_verdict_t;
+
+typedef struct
+{
+    gint width;
+    gint height;
+    gchar * buf;
+} nk_solve_verdict_matrix_t;
+
+extern NK_SOLVE_ERROR_CODE
+nk_solve_verdict_matrix_create(
+        gint height,
+        gint width,
+        nk_solve_verdict_matrix_t * * result
+        );
+
+extern NK_SOLVE_ERROR_CODE
+nk_solve_verdict_matrix_set(
+    nk_solve_verdict_matrix_t * board,
+    gint y,
+    gint x,
+    nk_solve_verdict_t value
+    );
+
+extern NK_SOLVE_ERROR_CODE
+nk_solve_verdict_matrix_get(
+    nk_solve_verdict_matrix_t * board,
+    gint y,
+    gint x,
+    nk_solve_verdict_t * value
+    );
+
+#endif /* #ifndef NK_SOLVE__VERDICT_MAT_H */
+