summaryrefslogtreecommitdiffstats
path: root/dab/algor.cc
diff options
context:
space:
mode:
Diffstat (limited to 'dab/algor.cc')
-rw-r--r--dab/algor.cc16
1 files changed, 8 insertions, 8 deletions
diff --git a/dab/algor.cc b/dab/algor.cc
index b84a3bda..1dbf7337 100644
--- a/dab/algor.cc
+++ b/dab/algor.cc
@@ -1,4 +1,4 @@
-/* $NetBSD: algor.cc,v 1.1 2003/12/27 01:16:55 christos Exp $ */
+/* $NetBSD: algor.cc,v 1.2 2005/08/09 02:38:32 christos Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
* algor.C: Computer algorithm
*/
#include "defs.h"
-RCSID("$NetBSD: algor.cc,v 1.1 2003/12/27 01:16:55 christos Exp $")
+RCSID("$NetBSD: algor.cc,v 1.2 2005/08/09 02:38:32 christos Exp $")
#include "algor.h"
#include "board.h"
@@ -132,7 +132,7 @@ size_t ALGOR::count_closure(size_t& y, size_t& x, int& dir, BOARD& b)
* return the number of boxes closed in the maximum closure,
* and the first box of the maximum closure in (x, y, dir)
*/
-int ALGOR::find_max_closure(size_t& y, size_t& x, int& dir, const BOARD& b)
+size_t ALGOR::find_max_closure(size_t& y, size_t& x, int& dir, const BOARD& b)
{
BOARD nb(b);
int tdir, maxdir = -1;
@@ -237,8 +237,8 @@ int ALGOR::find_bad_turn(size_t& y, size_t& x, int& dir, BOARD& b, int last)
return 0;
}
-int ALGOR::find_min_closure1(size_t& y, size_t& x, int& dir, const BOARD& b,
- int last)
+size_t ALGOR::find_min_closure1(size_t& y, size_t& x, int& dir, const BOARD& b,
+ int last)
{
BOARD nb(b);
int tdir, mindir = -1, xdir, mv;
@@ -275,11 +275,11 @@ int ALGOR::find_min_closure1(size_t& y, size_t& x, int& dir, const BOARD& b,
// Search for the move that makes the opponent close the least number of
// boxes; returns 1 if a move found, 0 otherwise
-int ALGOR::find_min_closure(size_t& y, size_t& x, int& dir, const BOARD& b)
+size_t ALGOR::find_min_closure(size_t& y, size_t& x, int& dir, const BOARD& b)
{
size_t x1, y1;
int dir1;
- int count = b.ny() * b.nx() + 1, count1;
+ size_t count = b.ny() * b.nx() + 1, count1;
for (size_t i = 0; i < 3; i++)
if (count > (count1 = find_min_closure1(y1, x1, dir1, b, i))) {
@@ -289,7 +289,7 @@ int ALGOR::find_min_closure(size_t& y, size_t& x, int& dir, const BOARD& b)
dir = dir1;
}
- return (size_t) count != b.ny() * b.nx() + 1;
+ return count != b.ny() * b.nx() + 1;
}
// Return a move in (y, x, dir)