summaryrefslogtreecommitdiff
path: root/apps/plugins/puzzles/src/puzzles.h
diff options
context:
space:
mode:
authorFranklin Wei <git@fwei.tk>2019-05-15 18:16:27 -0400
committerFranklin Wei <git@fwei.tk>2019-05-15 18:16:27 -0400
commitf940276fd9bc38ae34d4119fd1d983171a627400 (patch)
tree117a191e61c070548b4c55b35f6d1159f98f03f9 /apps/plugins/puzzles/src/puzzles.h
parent4ed57276542124a22c26ebb1d307996fc3a7556c (diff)
downloadrockbox-f940276fd9bc38ae34d4119fd1d983171a627400.tar.gz
rockbox-f940276fd9bc38ae34d4119fd1d983171a627400.zip
puzzles: resync with upstream
This brings the puzzles source to upstream commit e2135d5. (I've made my own changes on top of that.) This brings in a couple bugfixes and a new solver for Dominosa. Change-Id: I11d46b43171787832330a5e2e0d2f353f36f727d
Diffstat (limited to 'apps/plugins/puzzles/src/puzzles.h')
-rw-r--r--apps/plugins/puzzles/src/puzzles.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/apps/plugins/puzzles/src/puzzles.h b/apps/plugins/puzzles/src/puzzles.h
index 48d3d83b6e..1732abe3e9 100644
--- a/apps/plugins/puzzles/src/puzzles.h
+++ b/apps/plugins/puzzles/src/puzzles.h
@@ -595,6 +595,32 @@ bool findloop_run(struct findloopstate *state, int nvertices,
595bool findloop_is_loop_edge(struct findloopstate *state, int u, int v); 595bool findloop_is_loop_edge(struct findloopstate *state, int u, int v);
596 596
597/* 597/*
598 * Alternative query function, which returns true if the u-v edge is a
599 * _bridge_, i.e. a non-loop edge, i.e. an edge whose removal would
600 * disconnect a currently connected component of the graph.
601 *
602 * If the return value is true, then the numbers of vertices that
603 * would be in the new components containing u and v are written into
604 * u_vertices and v_vertices respectively.
605 */
606bool findloop_is_bridge(
607 struct findloopstate *pv, int u, int v, int *u_vertices, int *v_vertices);
608
609/*
610 * Helper function to sort an array. Differs from standard qsort in
611 * that it takes a context parameter that is passed to the compare
612 * function.
613 *
614 * I wrap it in a macro so that you only need to give the element
615 * count of the array. The element size is determined by sizeof.
616 */
617typedef int (*arraysort_cmpfn_t)(const void *av, const void *bv, void *ctx);
618void arraysort_fn(void *array, size_t nmemb, size_t size,
619 arraysort_cmpfn_t cmp, void *ctx);
620#define arraysort(array, nmemb, cmp, ctx) \
621 arraysort_fn(array, nmemb, sizeof(*(array)), cmp, ctx)
622
623/*
598 * Data structure containing the function calls and data specific 624 * Data structure containing the function calls and data specific
599 * to a particular game. This is enclosed in a data structure so 625 * to a particular game. This is enclosed in a data structure so
600 * that a particular platform can choose, if it wishes, to compile 626 * that a particular platform can choose, if it wishes, to compile