perfect: Fix or avoid build warnings
This commit is contained in:
parent
230aad1118
commit
03aaf2c082
|
@ -103,7 +103,7 @@ bool BufferedFile::flushBuffers()
|
|||
// Name: writeDataToFile()
|
||||
// Desc: Writes 'sizeInBytes'-bytes to the position 'offset' to the file.
|
||||
//-----------------------------------------------------------------------------
|
||||
void BufferedFile::writeDataToFile(HANDLE hFile, long long offset, unsigned int sizeInBytes, void *pData)
|
||||
void BufferedFile::writeDataToFile(HANDLE fd, long long offset, unsigned int sizeInBytes, void *pData)
|
||||
{
|
||||
DWORD dwBytesWritten;
|
||||
LARGE_INTEGER liDistanceToMove;
|
||||
|
@ -113,12 +113,12 @@ void BufferedFile::writeDataToFile(HANDLE hFile, long long offset, unsigned int
|
|||
|
||||
EnterCriticalSection(&csIO);
|
||||
|
||||
while (!SetFilePointerEx(hFile, liDistanceToMove, nullptr, FILE_BEGIN))
|
||||
while (!SetFilePointerEx(fd, liDistanceToMove, nullptr, FILE_BEGIN))
|
||||
cout << endl
|
||||
<< "SetFilePointerEx failed!";
|
||||
|
||||
while (restingBytes > 0) {
|
||||
if (WriteFile(hFile, pData, sizeInBytes, &dwBytesWritten, nullptr) == TRUE) {
|
||||
if (WriteFile(fd, pData, sizeInBytes, &dwBytesWritten, nullptr) == TRUE) {
|
||||
restingBytes -= dwBytesWritten;
|
||||
pData = (void *)(((unsigned char *)pData) + dwBytesWritten);
|
||||
if (restingBytes > 0)
|
||||
|
@ -137,7 +137,7 @@ void BufferedFile::writeDataToFile(HANDLE hFile, long long offset, unsigned int
|
|||
// Name: readDataFromFile()
|
||||
// Desc: Reads 'sizeInBytes'-bytes from the position 'offset' of the file.
|
||||
//-----------------------------------------------------------------------------
|
||||
void BufferedFile::readDataFromFile(HANDLE hFile, long long offset, unsigned int sizeInBytes, void *pData)
|
||||
void BufferedFile::readDataFromFile(HANDLE fd, long long offset, unsigned int sizeInBytes, void *pData)
|
||||
{
|
||||
DWORD dwBytesRead;
|
||||
LARGE_INTEGER liDistanceToMove;
|
||||
|
@ -147,12 +147,12 @@ void BufferedFile::readDataFromFile(HANDLE hFile, long long offset, unsigned int
|
|||
|
||||
EnterCriticalSection(&csIO);
|
||||
|
||||
while (!SetFilePointerEx(hFile, liDistanceToMove, nullptr, FILE_BEGIN))
|
||||
while (!SetFilePointerEx(fd, liDistanceToMove, nullptr, FILE_BEGIN))
|
||||
cout << endl
|
||||
<< "SetFilePointerEx failed!";
|
||||
|
||||
while (restingBytes > 0) {
|
||||
if (ReadFile(hFile, pData, sizeInBytes, &dwBytesRead, nullptr) == TRUE) {
|
||||
if (ReadFile(fd, pData, sizeInBytes, &dwBytesRead, nullptr) == TRUE) {
|
||||
restingBytes -= dwBytesRead;
|
||||
pData = (void *)(((unsigned char *)pData) + dwBytesRead);
|
||||
if (restingBytes > 0)
|
||||
|
|
|
@ -54,7 +54,7 @@ CyclicArray::~CyclicArray()
|
|||
// Name: writeDataToFile()
|
||||
// Desc: Writes 'sizeInBytes'-bytes to the position 'offset' to the file.
|
||||
//-----------------------------------------------------------------------------
|
||||
void CyclicArray::writeDataToFile(HANDLE hFile, long long offset, unsigned int sizeInBytes, void *pData)
|
||||
void CyclicArray::writeDataToFile(HANDLE fd, long long offset, unsigned int sizeInBytes, void *pData)
|
||||
{
|
||||
DWORD dwBytesWritten;
|
||||
LARGE_INTEGER liDistanceToMove;
|
||||
|
@ -62,12 +62,12 @@ void CyclicArray::writeDataToFile(HANDLE hFile, long long offset, unsigned int s
|
|||
|
||||
liDistanceToMove.QuadPart = offset;
|
||||
|
||||
while (!SetFilePointerEx(hFile, liDistanceToMove, nullptr, FILE_BEGIN))
|
||||
while (!SetFilePointerEx(fd, liDistanceToMove, nullptr, FILE_BEGIN))
|
||||
cout << endl
|
||||
<< "SetFilePointerEx failed!";
|
||||
|
||||
while (restingBytes > 0) {
|
||||
if (WriteFile(hFile, pData, sizeInBytes, &dwBytesWritten, nullptr) == TRUE) {
|
||||
if (WriteFile(fd, pData, sizeInBytes, &dwBytesWritten, nullptr) == TRUE) {
|
||||
restingBytes -= dwBytesWritten;
|
||||
pData = (void *)(((unsigned char *)pData) + dwBytesWritten);
|
||||
if (restingBytes > 0)
|
||||
|
@ -84,7 +84,7 @@ void CyclicArray::writeDataToFile(HANDLE hFile, long long offset, unsigned int s
|
|||
// Name: readDataFromFile()
|
||||
// Desc: Reads 'sizeInBytes'-bytes from the position 'offset' of the file.
|
||||
//-----------------------------------------------------------------------------
|
||||
void CyclicArray::readDataFromFile(HANDLE hFile, long long offset, unsigned int sizeInBytes, void *pData)
|
||||
void CyclicArray::readDataFromFile(HANDLE fd, long long offset, unsigned int sizeInBytes, void *pData)
|
||||
{
|
||||
DWORD dwBytesRead;
|
||||
LARGE_INTEGER liDistanceToMove;
|
||||
|
@ -92,12 +92,12 @@ void CyclicArray::readDataFromFile(HANDLE hFile, long long offset, unsigned int
|
|||
|
||||
liDistanceToMove.QuadPart = offset;
|
||||
|
||||
while (!SetFilePointerEx(hFile, liDistanceToMove, nullptr, FILE_BEGIN))
|
||||
while (!SetFilePointerEx(fd, liDistanceToMove, nullptr, FILE_BEGIN))
|
||||
cout << endl
|
||||
<< "SetFilePointerEx failed!";
|
||||
|
||||
while (restingBytes > 0) {
|
||||
if (ReadFile(hFile, pData, sizeInBytes, &dwBytesRead, nullptr) == TRUE) {
|
||||
if (ReadFile(fd, pData, sizeInBytes, &dwBytesRead, nullptr) == TRUE) {
|
||||
restingBytes -= dwBytesRead;
|
||||
pData = (void *)(((unsigned char *)pData) + dwBytesRead);
|
||||
if (restingBytes > 0)
|
||||
|
|
|
@ -131,11 +131,11 @@ void *MiniMax::getBestChoice(unsigned int tilLevel, unsigned int *choice, unsign
|
|||
// Name: calculateDatabase()
|
||||
// Desc: Calculates the database, which must be already open.
|
||||
//-----------------------------------------------------------------------------
|
||||
void MiniMax::calculateDatabase(unsigned int maxDepthOfTree, bool onlyPrepareLayer)
|
||||
void MiniMax::calculateDatabase(unsigned int maxDepthOfTree, bool onlyPrepLayer)
|
||||
{
|
||||
// locals
|
||||
bool abortCalculation = false;
|
||||
this->onlyPrepareLayer = onlyPrepareLayer;
|
||||
this->onlyPrepareLayer = onlyPrepLayer;
|
||||
lastCalculatedLayer.clear();
|
||||
|
||||
PRINT(1, this, "*************************");
|
||||
|
@ -174,7 +174,7 @@ void MiniMax::calculateDatabase(unsigned int maxDepthOfTree, bool onlyPrepareLay
|
|||
unloadAllPlyInfos();
|
||||
|
||||
// don't save layer and header when only preparing layers
|
||||
if (onlyPrepareLayer)
|
||||
if (onlyPrepLayer)
|
||||
return;
|
||||
if (abortCalculation)
|
||||
break;
|
||||
|
@ -185,7 +185,7 @@ void MiniMax::calculateDatabase(unsigned int maxDepthOfTree, bool onlyPrepareLay
|
|||
}
|
||||
|
||||
// don't save layer and header when only preparing layers or when
|
||||
if (onlyPrepareLayer)
|
||||
if (onlyPrepLayer)
|
||||
return;
|
||||
|
||||
if (!abortCalculation) {
|
||||
|
@ -220,15 +220,15 @@ void MiniMax::calculateDatabase(unsigned int maxDepthOfTree, bool onlyPrepareLay
|
|||
bool MiniMax::calcLayer(unsigned int layerNumber)
|
||||
{
|
||||
// locals
|
||||
vector<unsigned int> layersToCalculate;
|
||||
vector<unsigned int> layersToCalc;
|
||||
|
||||
// moves can be done reverse, leading to too depth searching trees
|
||||
if (shallRetroAnalysisBeUsed(layerNumber)) {
|
||||
// calc values for all states of layer
|
||||
layersToCalculate.push_back(layerNumber);
|
||||
layersToCalc.push_back(layerNumber);
|
||||
if (layerNumber != layerStats[layerNumber].partnerLayer)
|
||||
layersToCalculate.push_back(layerStats[layerNumber].partnerLayer);
|
||||
if (!calcKnotValuesByRetroAnalysis(layersToCalculate))
|
||||
layersToCalc.push_back(layerStats[layerNumber].partnerLayer);
|
||||
if (!calcKnotValuesByRetroAnalysis(layersToCalc))
|
||||
return false;
|
||||
|
||||
// save partner layer
|
||||
|
|
|
@ -24,6 +24,10 @@
|
|||
#include "threadManager.h"
|
||||
#include "bufferedFile.h"
|
||||
|
||||
#pragma warning(disable: 4100)
|
||||
#pragma warning(disable: 4238)
|
||||
#pragma warning(disable: 4244)
|
||||
|
||||
#pragma intrinsic(_rotl8, _rotr8) // for shifting bits
|
||||
|
||||
using namespace std; // use standard library namespace
|
||||
|
@ -93,6 +97,7 @@ database: The database contains the arrays with the short knot values and the
|
|||
(p) = nullptr; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define SAFE_DELETE_ARRAY(p) \
|
||||
{ \
|
||||
if (p) \
|
||||
|
@ -415,6 +420,7 @@ public:
|
|||
while (true)
|
||||
;
|
||||
};
|
||||
|
||||
virtual void printMoveInformation(unsigned int threadNo, unsigned int idPossibility, void *pPossibilities)
|
||||
{
|
||||
while (true)
|
||||
|
|
|
@ -8,6 +8,9 @@
|
|||
|
||||
#include "miniMax.h"
|
||||
|
||||
#pragma warning(disable: 4127)
|
||||
#pragma warning(disable: 4706)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: ~MiniMax()
|
||||
// Desc: MiniMax class destructor
|
||||
|
@ -451,7 +454,7 @@ void MiniMax::readKnotValueFromDatabase(unsigned int layerNumber, unsigned int s
|
|||
// locals
|
||||
TwoBit databaseByte;
|
||||
long long bytesAllocated;
|
||||
TwoBit defValue = SKV_WHOLE_BYTE_IS_INVALID;
|
||||
//TwoBit defValue = SKV_WHOLE_BYTE_IS_INVALID;
|
||||
LayerStats *myLss = &layerStats[layerNumber];
|
||||
|
||||
// valid state and layer number ?
|
||||
|
@ -579,7 +582,7 @@ void MiniMax::saveKnotValueInDatabase(unsigned int layerNumber, unsigned int sta
|
|||
{
|
||||
// locals
|
||||
long long bytesAllocated;
|
||||
TwoBit defValue = SKV_WHOLE_BYTE_IS_INVALID;
|
||||
//TwoBit defValue = SKV_WHOLE_BYTE_IS_INVALID;
|
||||
LayerStats *myLss = &layerStats[layerNumber];
|
||||
|
||||
// valid state and layer number ?
|
||||
|
|
|
@ -17,7 +17,7 @@ s\*********************************************************************/
|
|||
// Each time the short knot value of a game state has been determined, the state will be added to 'statesToProcess'.
|
||||
// This list is like a queue of states, which still has to be processed.
|
||||
//-----------------------------------------------------------------------------
|
||||
bool MiniMax::calcKnotValuesByRetroAnalysis(vector<unsigned int> &layersToCalculate)
|
||||
bool MiniMax::calcKnotValuesByRetroAnalysis(vector<unsigned int> &layersToCalc)
|
||||
{
|
||||
// locals
|
||||
bool abortCalculation = false;
|
||||
|
@ -35,29 +35,29 @@ bool MiniMax::calcKnotValuesByRetroAnalysis(vector<unsigned int> &layersToCalcul
|
|||
retroVars.thread[threadNo].numStatesToProcess = 0;
|
||||
retroVars.thread[threadNo].threadNo = threadNo;
|
||||
}
|
||||
retroVars.countArrays.resize(layersToCalculate.size(), nullptr);
|
||||
retroVars.countArrays.resize(layersToCalc.size(), nullptr);
|
||||
retroVars.layerInitialized.resize(skvfHeader.numLayers, false);
|
||||
retroVars.layersToCalculate = layersToCalculate;
|
||||
retroVars.layersToCalculate = layersToCalc;
|
||||
retroVars.pMiniMax = this;
|
||||
|
||||
for (retroVars.totalNumKnots = 0, retroVars.numKnotsToCalc = 0, curLayer = 0; curLayer < layersToCalculate.size(); curLayer++) {
|
||||
retroVars.numKnotsToCalc += layerStats[layersToCalculate[curLayer]].knotsInLayer;
|
||||
retroVars.totalNumKnots += layerStats[layersToCalculate[curLayer]].knotsInLayer;
|
||||
retroVars.layerInitialized[layersToCalculate[curLayer]] = true;
|
||||
for (curSubLayer = 0; curSubLayer < layerStats[layersToCalculate[curLayer]].numSuccLayers; curSubLayer++) {
|
||||
if (retroVars.layerInitialized[layerStats[layersToCalculate[curLayer]].succLayers[curSubLayer]])
|
||||
for (retroVars.totalNumKnots = 0, retroVars.numKnotsToCalc = 0, curLayer = 0; curLayer < layersToCalc.size(); curLayer++) {
|
||||
retroVars.numKnotsToCalc += layerStats[layersToCalc[curLayer]].knotsInLayer;
|
||||
retroVars.totalNumKnots += layerStats[layersToCalc[curLayer]].knotsInLayer;
|
||||
retroVars.layerInitialized[layersToCalc[curLayer]] = true;
|
||||
for (curSubLayer = 0; curSubLayer < layerStats[layersToCalc[curLayer]].numSuccLayers; curSubLayer++) {
|
||||
if (retroVars.layerInitialized[layerStats[layersToCalc[curLayer]].succLayers[curSubLayer]])
|
||||
continue;
|
||||
else
|
||||
retroVars.layerInitialized[layerStats[layersToCalculate[curLayer]].succLayers[curSubLayer]] = true;
|
||||
retroVars.totalNumKnots += layerStats[layerStats[layersToCalculate[curLayer]].succLayers[curSubLayer]].knotsInLayer;
|
||||
retroVars.layerInitialized[layerStats[layersToCalc[curLayer]].succLayers[curSubLayer]] = true;
|
||||
retroVars.totalNumKnots += layerStats[layerStats[layersToCalc[curLayer]].succLayers[curSubLayer]].knotsInLayer;
|
||||
}
|
||||
}
|
||||
|
||||
retroVars.layerInitialized.assign(skvfHeader.numLayers, false);
|
||||
|
||||
// output & filenames
|
||||
for (curLayer = 0; curLayer < layersToCalculate.size(); curLayer++)
|
||||
ssLayers << " " << layersToCalculate[curLayer];
|
||||
for (curLayer = 0; curLayer < layersToCalc.size(); curLayer++)
|
||||
ssLayers << " " << layersToCalc[curLayer];
|
||||
PRINT(0, this, "*** Calculate layers" << ssLayers.str() << " by retro analysis ***");
|
||||
|
||||
// initialization
|
||||
|
@ -87,8 +87,8 @@ bool MiniMax::calcKnotValuesByRetroAnalysis(vector<unsigned int> &layersToCalcul
|
|||
|
||||
// show output
|
||||
PRINT(2, this, " Bytes in memory: " << memoryUsed2);
|
||||
for (curLayer = 0; curLayer < layersToCalculate.size(); curLayer++) {
|
||||
showLayerStats(layersToCalculate[curLayer]);
|
||||
for (curLayer = 0; curLayer < layersToCalc.size(); curLayer++) {
|
||||
showLayerStats(layersToCalc[curLayer]);
|
||||
}
|
||||
PRINT(2, this, "");
|
||||
|
||||
|
@ -100,10 +100,10 @@ freeMem:
|
|||
}
|
||||
}
|
||||
|
||||
for (curLayer = 0; curLayer < layersToCalculate.size(); curLayer++) {
|
||||
for (curLayer = 0; curLayer < layersToCalc.size(); curLayer++) {
|
||||
if (retroVars.countArrays[curLayer] != nullptr) {
|
||||
memoryUsed2 -= layerStats[layersToCalculate[curLayer]].knotsInLayer * sizeof(CountArrayVarType);
|
||||
arrayInfos.removeArray(layersToCalculate[curLayer], ArrayInfo::arrayType_countArray, layerStats[layersToCalculate[curLayer]].knotsInLayer * sizeof(CountArrayVarType), 0);
|
||||
memoryUsed2 -= layerStats[layersToCalc[curLayer]].knotsInLayer * sizeof(CountArrayVarType);
|
||||
arrayInfos.removeArray(layersToCalc[curLayer], ArrayInfo::arrayType_countArray, layerStats[layersToCalc[curLayer]].knotsInLayer * sizeof(CountArrayVarType), 0);
|
||||
}
|
||||
SAFE_DELETE_ARRAY(retroVars.countArrays[curLayer]);
|
||||
}
|
||||
|
|
|
@ -319,7 +319,7 @@ bool MiniMax::testState(unsigned int layerNumber, unsigned int stateNumber)
|
|||
{
|
||||
// locals
|
||||
TestLayersVars tlVars;
|
||||
bool result;
|
||||
bool result = false;
|
||||
|
||||
// prepare parameters for multithreading
|
||||
tlVars.curThreadNo = 0;
|
||||
|
@ -487,7 +487,7 @@ DWORD MiniMax::testSetSituationThreadProc(void *pParameter, int index)
|
|||
|
||||
//errorInDatabase:
|
||||
// terminate all threads
|
||||
return TM_RETURN_VALUE_TERMINATE_ALL_THREADS;
|
||||
//return TM_RETURN_VALUE_TERMINATE_ALL_THREADS;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
@ -220,26 +220,27 @@ PerfectAI::PerfectAI(const char *directory)
|
|||
|
||||
ssPreCalcVarsFilePath << "preCalculatedVars.dat";
|
||||
hFilePreCalcVars = CreateFileA(ssPreCalcVarsFilePath.str().c_str(), GENERIC_READ /*| GENERIC_WRITE*/, FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
|
||||
ReadFile(hFilePreCalcVars, &preCalcVarsHeader, sizeof(PreCalcedVarsFileHeader), &dwBytesRead, nullptr);
|
||||
if (!ReadFile(hFilePreCalcVars, &preCalcVarsHeader, sizeof(PreCalcedVarsFileHeader), &dwBytesRead, nullptr))
|
||||
return;
|
||||
|
||||
// vars already stored in file?
|
||||
if (dwBytesRead) {
|
||||
// Read from file
|
||||
ReadFile(hFilePreCalcVars, layer, sizeof(Layer) * NUM_LAYERS, &dwBytesRead, nullptr);
|
||||
ReadFile(hFilePreCalcVars, layerIndex, sizeof(unsigned int) * 2 * NUM_STONES_PER_PLAYER_PLUS_ONE * NUM_STONES_PER_PLAYER_PLUS_ONE, &dwBytesRead, nullptr);
|
||||
ReadFile(hFilePreCalcVars, anzahlStellungenAB, sizeof(unsigned int) * NUM_STONES_PER_PLAYER_PLUS_ONE * NUM_STONES_PER_PLAYER_PLUS_ONE, &dwBytesRead, nullptr);
|
||||
ReadFile(hFilePreCalcVars, anzahlStellungenCD, sizeof(unsigned int) * NUM_STONES_PER_PLAYER_PLUS_ONE * NUM_STONES_PER_PLAYER_PLUS_ONE, &dwBytesRead, nullptr);
|
||||
ReadFile(hFilePreCalcVars, indexAB, sizeof(unsigned int) * MAX_ANZ_STELLUNGEN_A * MAX_ANZ_STELLUNGEN_B, &dwBytesRead, nullptr);
|
||||
ReadFile(hFilePreCalcVars, indexCD, sizeof(unsigned int) * MAX_ANZ_STELLUNGEN_C * MAX_ANZ_STELLUNGEN_D, &dwBytesRead, nullptr);
|
||||
ReadFile(hFilePreCalcVars, symmetryOperationCD, sizeof(unsigned char) * MAX_ANZ_STELLUNGEN_C * MAX_ANZ_STELLUNGEN_D, &dwBytesRead, nullptr);
|
||||
ReadFile(hFilePreCalcVars, powerOfThree, sizeof(unsigned int) * (numSquaresGroupC + numSquaresGroupD), &dwBytesRead, nullptr);
|
||||
ReadFile(hFilePreCalcVars, symmetryOperationTable, sizeof(unsigned int) * fieldStruct::size * NUM_SYM_OPERATIONS, &dwBytesRead, nullptr);
|
||||
ReadFile(hFilePreCalcVars, reverseSymOperation, sizeof(unsigned int) * NUM_SYM_OPERATIONS, &dwBytesRead, nullptr);
|
||||
ReadFile(hFilePreCalcVars, concSymOperation, sizeof(unsigned int) * NUM_SYM_OPERATIONS * NUM_SYM_OPERATIONS, &dwBytesRead, nullptr);
|
||||
ReadFile(hFilePreCalcVars, mOverN, sizeof(unsigned int) * (fieldStruct::size + 1) * (fieldStruct::size + 1), &dwBytesRead, nullptr);
|
||||
ReadFile(hFilePreCalcVars, valueOfMove, sizeof(unsigned char) * fieldStruct::size * fieldStruct::size, &dwBytesRead, nullptr);
|
||||
ReadFile(hFilePreCalcVars, plyInfoForOutput, sizeof(PlyInfoVarType) * fieldStruct::size * fieldStruct::size, &dwBytesRead, nullptr);
|
||||
ReadFile(hFilePreCalcVars, incidencesValuesSubMoves, sizeof(unsigned int) * 4 * fieldStruct::size * fieldStruct::size, &dwBytesRead, nullptr);
|
||||
if (!ReadFile(hFilePreCalcVars, layer, sizeof(Layer) * NUM_LAYERS, &dwBytesRead, nullptr)) return;
|
||||
if (!ReadFile(hFilePreCalcVars, layerIndex, sizeof(unsigned int) * 2 * NUM_STONES_PER_PLAYER_PLUS_ONE * NUM_STONES_PER_PLAYER_PLUS_ONE, &dwBytesRead, nullptr)) return;
|
||||
if (!ReadFile(hFilePreCalcVars, anzahlStellungenAB, sizeof(unsigned int) * NUM_STONES_PER_PLAYER_PLUS_ONE * NUM_STONES_PER_PLAYER_PLUS_ONE, &dwBytesRead, nullptr)) return;
|
||||
if (!ReadFile(hFilePreCalcVars, anzahlStellungenCD, sizeof(unsigned int) * NUM_STONES_PER_PLAYER_PLUS_ONE * NUM_STONES_PER_PLAYER_PLUS_ONE, &dwBytesRead, nullptr)) return;
|
||||
if (!ReadFile(hFilePreCalcVars, indexAB, sizeof(unsigned int) * MAX_ANZ_STELLUNGEN_A * MAX_ANZ_STELLUNGEN_B, &dwBytesRead, nullptr)) return;
|
||||
if (!ReadFile(hFilePreCalcVars, indexCD, sizeof(unsigned int) * MAX_ANZ_STELLUNGEN_C * MAX_ANZ_STELLUNGEN_D, &dwBytesRead, nullptr)) return;
|
||||
if (!ReadFile(hFilePreCalcVars, symmetryOperationCD, sizeof(unsigned char) * MAX_ANZ_STELLUNGEN_C * MAX_ANZ_STELLUNGEN_D, &dwBytesRead, nullptr)) return;
|
||||
if (!ReadFile(hFilePreCalcVars, powerOfThree, sizeof(unsigned int) * (numSquaresGroupC + numSquaresGroupD), &dwBytesRead, nullptr)) return;
|
||||
if (!ReadFile(hFilePreCalcVars, symmetryOperationTable, sizeof(unsigned int) * fieldStruct::size * NUM_SYM_OPERATIONS, &dwBytesRead, nullptr)) return;
|
||||
if (!ReadFile(hFilePreCalcVars, reverseSymOperation, sizeof(unsigned int) * NUM_SYM_OPERATIONS, &dwBytesRead, nullptr)) return;
|
||||
if (!ReadFile(hFilePreCalcVars, concSymOperation, sizeof(unsigned int) * NUM_SYM_OPERATIONS * NUM_SYM_OPERATIONS, &dwBytesRead, nullptr)) return;
|
||||
if (!ReadFile(hFilePreCalcVars, mOverN, sizeof(unsigned int) * (fieldStruct::size + 1) * (fieldStruct::size + 1), &dwBytesRead, nullptr)) return;
|
||||
if (!ReadFile(hFilePreCalcVars, valueOfMove, sizeof(unsigned char) * fieldStruct::size * fieldStruct::size, &dwBytesRead, nullptr)) return;
|
||||
if (!ReadFile(hFilePreCalcVars, plyInfoForOutput, sizeof(PlyInfoVarType) * fieldStruct::size * fieldStruct::size, &dwBytesRead, nullptr)) return;
|
||||
if (!ReadFile(hFilePreCalcVars, incidencesValuesSubMoves, sizeof(unsigned int) * 4 * fieldStruct::size * fieldStruct::size, &dwBytesRead, nullptr)) return;
|
||||
|
||||
// process originalStateAB[][]
|
||||
for (a = 0; a <= NUM_STONES_PER_PLAYER; a++) {
|
||||
|
@ -247,7 +248,7 @@ PerfectAI::PerfectAI(const char *directory)
|
|||
if (a + b > numSquaresGroupA + numSquaresGroupB)
|
||||
continue;
|
||||
originalStateAB[a][b] = new unsigned int[anzahlStellungenAB[a][b]];
|
||||
ReadFile(hFilePreCalcVars, originalStateAB[a][b], sizeof(unsigned int) * anzahlStellungenAB[a][b], &dwBytesRead, nullptr);
|
||||
if (!ReadFile(hFilePreCalcVars, originalStateAB[a][b], sizeof(unsigned int) * anzahlStellungenAB[a][b], &dwBytesRead, nullptr)) return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -257,7 +258,7 @@ PerfectAI::PerfectAI(const char *directory)
|
|||
if (a + b > numSquaresGroupC + numSquaresGroupD)
|
||||
continue;
|
||||
originalStateCD[a][b] = new unsigned int[anzahlStellungenCD[a][b]];
|
||||
ReadFile(hFilePreCalcVars, originalStateCD[a][b], sizeof(unsigned int) * anzahlStellungenCD[a][b], &dwBytesRead, nullptr);
|
||||
if (!ReadFile(hFilePreCalcVars, originalStateCD[a][b], sizeof(unsigned int) * anzahlStellungenCD[a][b], &dwBytesRead, nullptr)) return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1654,7 +1655,7 @@ bool PerfectAI::setSituation(unsigned int threadNo, unsigned int layerNum, unsig
|
|||
unsigned int numBlackStones = layer[layerNum].numBlackStones;
|
||||
unsigned int numberOfMillsCurrentPlayer = 0;
|
||||
unsigned int numberOfMillsOpponentPlayer = 0;
|
||||
unsigned int wCD, bCD, wAB, bAB;
|
||||
unsigned int wCD = 0, bCD = 0, wAB = 0, bAB = 0;
|
||||
unsigned int i;
|
||||
bool aStoneCanBeRemovedFromCurPlayer;
|
||||
|
||||
|
@ -2526,7 +2527,7 @@ bool PerfectAI::checkGetPossThanGetPred()
|
|||
void *pBackup;
|
||||
RetroAnalysisPredVars predVars[MAX_NUM_PREDECESSORS];
|
||||
unsigned int threadNo = 0;
|
||||
ThreadVars *tv = &threadVars[threadNo];
|
||||
//ThreadVars *tv = &threadVars[threadNo];
|
||||
|
||||
// test if each successor from getPossibilities() leads to the original state using getPredecessors()
|
||||
for (layerNum = 0; layerNum < NUM_LAYERS; layerNum++) {
|
||||
|
@ -2572,6 +2573,7 @@ bool PerfectAI::checkGetPossThanGetPred()
|
|||
<< "ERROR: STATE " << stateNum << " NOT FOUND IN PREDECESSOR LIST";
|
||||
return false;
|
||||
|
||||
#if 0
|
||||
// perform several commands to see in debug mode where the error occurs
|
||||
undo(threadNo, idPossibility[i], isOpponentLevel, pBackup, pPossibilities);
|
||||
setSituation(threadNo, layerNum, stateNum);
|
||||
|
@ -2583,6 +2585,7 @@ bool PerfectAI::checkGetPossThanGetPred()
|
|||
printBoard(threadNo, 0);
|
||||
getPredecessors(threadNo, &amountOfPred, predVars);
|
||||
getPredecessors(threadNo, &amountOfPred, predVars);
|
||||
#endif
|
||||
}
|
||||
|
||||
// undo move
|
||||
|
@ -2649,6 +2652,7 @@ bool PerfectAI::checkGetPredThanGetPoss()
|
|||
<< "ERROR SETTING SITUATION";
|
||||
return false;
|
||||
|
||||
#if 0
|
||||
// perform several commands to see in debug mode where the error occurs
|
||||
for (k = 0; k < tv->field->size; k++)
|
||||
symField[k] = tv->field->board[k];
|
||||
|
@ -2677,6 +2681,7 @@ bool PerfectAI::checkGetPredThanGetPoss()
|
|||
cout << " layerNum: " << layerNum << "\tstateNum: " << stateNum << endl;
|
||||
printBoard(threadNo, 0);
|
||||
getPredecessors(threadNo, &amountOfPred, predVars);
|
||||
#endif
|
||||
}
|
||||
|
||||
// regard used symmetry operation
|
||||
|
|
Loading…
Reference in New Issue