commit db1514594b0dd5be498ab2f96f7fa0b7a1f09031
parent 1d9b390f1c02faeed11e3937674e8fb6a053e45c
Author: Antoine Amarilli <a3nm@a3nm.net>
Date: Sat, 7 Jun 2014 19:41:51 +0200
add support for multiple random
Diffstat:
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/main.c b/main.c
@@ -26,7 +26,11 @@
// upper bound on grid size (N) for static allocation
#define MAXN 20
// number of useless steps to make before doing a random move
-#define UBOUND 10
+#define UBOUND 30
+
+// C1/C2 is the probability of going on doing an additional random move
+#define C1 3
+#define C2 5
const int debug = 0;
@@ -503,7 +507,9 @@ int main(int argc, char **argv) {
if (useless > UBOUND) {
// too many useless steps, do a random move
useless = 0;
- tot += random_move();
+ do {
+ tot += random_move();
+ } while ((rand() % C2) < C1);
}
}
// we have found a configuration for K rooks; display it