shithub: puzzles

Download patch

ref: f05c25347d66821d928668a7e87dffbf3ffed027
parent: 6837cc46cd4e9341abd393d0269f24538f39e7ae
author: Simon Tatham <anakin@pobox.com>
date: Sat Aug 5 12:35:25 EDT 2006

Extra utility function.

[originally from svn r6780]

--- a/dsf.c
+++ b/dsf.c
@@ -28,3 +28,11 @@
     v2 = dsf_canonify(dsf, v2);
     dsf[v2] = v1;
 }
+
+void dsf_init(int *dsf, int len)
+{
+    int i;
+
+    for (i = 0; i < len; i++)
+	dsf[i] = i;
+}
--- a/puzzles.h
+++ b/puzzles.h
@@ -280,6 +280,7 @@
  */
 int dsf_canonify(int *dsf, int val);
 void dsf_merge(int *dsf, int v1, int v2);
+void dsf_init(int *dsf, int len);
 
 /*
  * version.c