|
///////////////////////////////////////////////////////////////////////////////
// OthelloCore1.cpp Ver. 1.5
// Programmer: PARK Youngho
///////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include <cstdlib>
#include <cassert>
#include "OthelloCore1.h"
OthelloCore1::OthelloCore1 (const char firstPlayer)
:OthelloCore(firstPlayer)
{
}
OthelloCore1::OthelloCore1 (int diag, const char firstPlayer)
:OthelloCore(diag, firstPlayer)
{
}
OthelloCore1::OthelloCore1 (OthelloCore1* that)
:OthelloCore(that)
{
}
OthelloCore1::~OthelloCore1 (void)
{
}
bool OthelloCore1::SeekBestPoint (int* px, int* py, const int player)
{
int bestX = 0, bestY = 0, kill = 0, ret;
for (int x = 0; x < OTHELLO_WIDTH; x++)
{
for (int y = 0; y < OTHELLO_WIDTH; y++)
{
ret = Evaluate(C[x], C[y], player);
if (ret > kill)
{
bestX = C[x];
bestY = C[y];
kill = ret;
}
}
}
if (!bestX)
return false;
if (px)
*px = bestX;
if (py)
*py = bestY;
return true;
}
#ifdef OTHELLO_IQ_TEST
OthelloCore1* OthelloCore1::CreateOthelloCoreTest (int diag, const char firstPlayer)
{
return new OthelloCore1(diag, firstPlayer);
}
#endif
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I like programming.
I am teaching at AUCA (American University of Central Asia) now.