diff --git a/bot.py b/bot.py index b15c8dc..620e399 100644 --- a/bot.py +++ b/bot.py @@ -52,7 +52,7 @@ class Bot: # TODO: Test this, the score results should be deterministic def make_pubeval_move(self, board, sym, roll): legal_moves = Board.calculate_legal_states(tuple(board), sym, roll) - moves_and_scores = [(board, pubeval.eval(board)) for board in legal_moves] + moves_and_scores = [(board, pubeval.eval(False, board)) for board in legal_moves] scores = [ x[1] for x in moves_and_scores ] best_move_pair = moves_and_scores[np.array(scores).argmax()] return best_move_pair diff --git a/pubeval/pubeval.c b/pubeval/pubeval.c index 26c3f8b..159ee09 100644 --- a/pubeval/pubeval.c +++ b/pubeval/pubeval.c @@ -126,17 +126,17 @@ float pubeval(int race, int pos[]) static PyObject* pubeval_eval(PyObject *self, PyObject *args) { + int race; long numValues; int board[28]; float eval_score; PyObject* tuple_obj; PyObject* val_obj; - PyObject* return_obj; - if (! PyArg_ParseTuple(args, "O!", &PyTuple_Type, &tuple_obj)) + if (! PyArg_ParseTuple(args, "pO!", &race, &PyTuple_Type, &tuple_obj)) return NULL; - + numValues = PyTuple_Size(tuple_obj); if (numValues < 0) return NULL; @@ -147,9 +147,8 @@ pubeval_eval(PyObject *self, PyObject *args) { board[i] = PyLong_AsLong(val_obj); } - eval_score = pubeval(0, board); - return_obj = Py_BuildValue("f", eval_score); - return return_obj; + eval_score = pubeval(race, board); + return Py_BuildValue("f", eval_score); } static PyMethodDef pubeval_methods[] = { diff --git a/pubeval/setup.py b/pubeval/setup.py index 669a087..3a9f114 100644 --- a/pubeval/setup.py +++ b/pubeval/setup.py @@ -4,6 +4,6 @@ pubeval = Extension('pubeval', sources = ['pubeval.c']) setup (name = 'pubeval', - version = '0.1', + version = '0.2', description = 'Pubeval for Python', ext_modules = [pubeval])