perfect: Fix spelling errors

This commit is contained in:
Calcitem 2021-01-22 22:47:56 +08:00
parent 03aaf2c082
commit 4674670459
25 changed files with 509 additions and 507 deletions

View File

@ -9,8 +9,8 @@
#include "bufferedFile.h"
//-----------------------------------------------------------------------------
// Name: bufferedFile()
// Desc: Creates a cyclic array. The passed file is used as temporary data buffer for the cyclic array.
// bufferedFile()
// Creates a cyclic array. The passed file is used as temporary data buffer for the cyclic array.
//-----------------------------------------------------------------------------
BufferedFile::BufferedFile(unsigned int numberOfThreads, unsigned int bufferSizeInBytes, const char *fileName)
{
@ -39,7 +39,7 @@ BufferedFile::BufferedFile(unsigned int numberOfThreads, unsigned int bufferSize
// Open Database-File (FILE_FLAG_NO_BUFFERING | FILE_FLAG_WRITE_THROUGH | FILE_FLAG_RANDOM_ACCESS)
hFile = CreateFileA(fileName, GENERIC_READ | GENERIC_WRITE, 0, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
// opened file succesfully
// opened file successfully
if (hFile == INVALID_HANDLE_VALUE) {
hFile = nullptr;
return;
@ -50,8 +50,8 @@ BufferedFile::BufferedFile(unsigned int numberOfThreads, unsigned int bufferSize
}
//-----------------------------------------------------------------------------
// Name: ~BufferedFile()
// Desc: BufferedFile class destructor
// ~BufferedFile()
// BufferedFile class destructor
//-----------------------------------------------------------------------------
BufferedFile::~BufferedFile()
{
@ -73,8 +73,8 @@ BufferedFile::~BufferedFile()
}
//-----------------------------------------------------------------------------
// Name: getFileSize()
// Desc:
// getFileSize()
//
//-----------------------------------------------------------------------------
long long BufferedFile::getFileSize()
{
@ -86,8 +86,8 @@ long long BufferedFile::getFileSize()
}
//-----------------------------------------------------------------------------
// Name: flushBuffers()
// Desc:
// flushBuffers()
//
//-----------------------------------------------------------------------------
bool BufferedFile::flushBuffers()
{
@ -100,8 +100,8 @@ bool BufferedFile::flushBuffers()
}
//-----------------------------------------------------------------------------
// Name: writeDataToFile()
// Desc: Writes 'sizeInBytes'-bytes to the position 'offset' to the file.
// writeDataToFile()
// Writes 'sizeInBytes'-bytes to the position 'offset' to the file.
//-----------------------------------------------------------------------------
void BufferedFile::writeDataToFile(HANDLE fd, long long offset, unsigned int sizeInBytes, void *pData)
{
@ -134,8 +134,8 @@ void BufferedFile::writeDataToFile(HANDLE fd, long long offset, unsigned int siz
}
//-----------------------------------------------------------------------------
// Name: readDataFromFile()
// Desc: Reads 'sizeInBytes'-bytes from the position 'offset' of the file.
// readDataFromFile()
// Reads 'sizeInBytes'-bytes from the position 'offset' of the file.
//-----------------------------------------------------------------------------
void BufferedFile::readDataFromFile(HANDLE fd, long long offset, unsigned int sizeInBytes, void *pData)
{
@ -168,8 +168,8 @@ void BufferedFile::readDataFromFile(HANDLE fd, long long offset, unsigned int si
}
//-----------------------------------------------------------------------------
// Name: writeBytes()
// Desc:
// writeBytes()
//
//-----------------------------------------------------------------------------
bool BufferedFile::writeBytes(unsigned int numBytes, unsigned char *pData)
{
@ -177,8 +177,8 @@ bool BufferedFile::writeBytes(unsigned int numBytes, unsigned char *pData)
}
//-----------------------------------------------------------------------------
// Name: writeBytes()
// Desc:
// writeBytes()
//
//-----------------------------------------------------------------------------
bool BufferedFile::writeBytes(unsigned int threadNo, long long positionInFile, unsigned int numBytes, unsigned char *pData)
{
@ -208,8 +208,8 @@ bool BufferedFile::writeBytes(unsigned int threadNo, long long positionInFile, u
}
//-----------------------------------------------------------------------------
// Name: takeBytes()
// Desc:
// takeBytes()
//
//-----------------------------------------------------------------------------
bool BufferedFile::readBytes(unsigned int numBytes, unsigned char *pData)
{
@ -217,8 +217,8 @@ bool BufferedFile::readBytes(unsigned int numBytes, unsigned char *pData)
}
//-----------------------------------------------------------------------------
// Name: takeBytes()
// Desc:
// takeBytes()
//
//-----------------------------------------------------------------------------
bool BufferedFile::readBytes(unsigned int threadNo, long long positionInFile, unsigned int numBytes, unsigned char *pData)
{
@ -243,4 +243,4 @@ bool BufferedFile::readBytes(unsigned int threadNo, long long positionInFile, un
// everything ok
return true;
}
}

View File

@ -15,8 +15,6 @@
using namespace std;
/*** Klassen *********************************************************/
class BufferedFile
{
private:

View File

@ -9,8 +9,8 @@
#include "cyclicArray.h"
//-----------------------------------------------------------------------------
// Name: CyclicArray()
// Desc: Creates a cyclic array. The passed file is used as temporary data buffer for the cyclic array.
// CyclicArray()
// Creates a cyclic array. The passed file is used as temporary data buffer for the cyclic array.
//-----------------------------F------------------------------------------------
CyclicArray::CyclicArray(unsigned int blockSizeInBytes, unsigned int numberOfBlocks, const char *fileName)
{
@ -36,8 +36,8 @@ CyclicArray::CyclicArray(unsigned int blockSizeInBytes, unsigned int numberOfBlo
}
//-----------------------------------------------------------------------------
// Name: ~RandomAI()
// Desc: RandomAI class destructor
// ~RandomAI()
// RandomAI class destructor
//-----------------------------------------------------------------------------
CyclicArray::~CyclicArray()
{
@ -51,8 +51,8 @@ CyclicArray::~CyclicArray()
}
//-----------------------------------------------------------------------------
// Name: writeDataToFile()
// Desc: Writes 'sizeInBytes'-bytes to the position 'offset' to the file.
// writeDataToFile()
// Writes 'sizeInBytes'-bytes to the position 'offset' to the file.
//-----------------------------------------------------------------------------
void CyclicArray::writeDataToFile(HANDLE fd, long long offset, unsigned int sizeInBytes, void *pData)
{
@ -81,8 +81,8 @@ void CyclicArray::writeDataToFile(HANDLE fd, long long offset, unsigned int size
}
//-----------------------------------------------------------------------------
// Name: readDataFromFile()
// Desc: Reads 'sizeInBytes'-bytes from the position 'offset' of the file.
// readDataFromFile()
// Reads 'sizeInBytes'-bytes from the position 'offset' of the file.
//-----------------------------------------------------------------------------
void CyclicArray::readDataFromFile(HANDLE fd, long long offset, unsigned int sizeInBytes, void *pData)
{
@ -111,8 +111,8 @@ void CyclicArray::readDataFromFile(HANDLE fd, long long offset, unsigned int siz
}
//-----------------------------------------------------------------------------
// Name: addBytes()
// Desc: Add the passed data to the cyclic array. If the writing pointer reaches the end of a block,
// addBytes()
// Add the passed data to the cyclic array. If the writing pointer reaches the end of a block,
// the data of the whole block is written to the file and the next block is considered for writing.
//-----------------------------------------------------------------------------
bool CyclicArray::addBytes(unsigned int numBytes, unsigned char *pData)
@ -159,8 +159,8 @@ bool CyclicArray::addBytes(unsigned int numBytes, unsigned char *pData)
}
//-----------------------------------------------------------------------------
// Name: bytesAvailable()
// Desc:
// bytesAvailable()
//
//-----------------------------------------------------------------------------
bool CyclicArray::bytesAvailable()
{
@ -171,8 +171,8 @@ bool CyclicArray::bytesAvailable()
}
//-----------------------------------------------------------------------------
// Name: takeBytes()
// Desc: Load data from the cyclic array. If the reading pointer reaches the end of a block,
// takeBytes()
// Load data from the cyclic array. If the reading pointer reaches the end of a block,
// the data of the next whole block is read from the file.
//-----------------------------------------------------------------------------
bool CyclicArray::takeBytes(unsigned int numBytes, unsigned char *pData)
@ -218,8 +218,8 @@ bool CyclicArray::takeBytes(unsigned int numBytes, unsigned char *pData)
}
//-----------------------------------------------------------------------------
// Name: loadFile()
// Desc: Load the passed file into the cyclic array.
// loadFile()
// Load the passed file into the cyclic array.
// The passed filename must be different than the passed filename to the constructor cyclicarray().
//-----------------------------------------------------------------------------
bool CyclicArray::loadFile(const char *fileName, LONGLONG &numBytesLoaded)
@ -288,8 +288,8 @@ bool CyclicArray::loadFile(const char *fileName, LONGLONG &numBytesLoaded)
}
//-----------------------------------------------------------------------------
// Name: saveFile()
// Desc: Writes the whole current content of the cyclic array to the passed file.
// saveFile()
// Writes the whole current content of the cyclic array to the passed file.
// The passed filename must be different than the passed filename to the constructor cyclicarray().
//-----------------------------------------------------------------------------
bool CyclicArray::saveFile(const char *fileName)
@ -353,4 +353,4 @@ bool CyclicArray::saveFile(const char *fileName)
delete[] dataInFile;
CloseHandle(hSaveFile);
return true;
}
}

View File

@ -15,8 +15,6 @@
using namespace std;
/*** Klassen *********************************************************/
class CyclicArray
{
private:

View File

@ -9,8 +9,8 @@
#include "mill.h"
//-----------------------------------------------------------------------------
// Name: Mill()
// Desc: Mill class constructor
// Mill()
// Mill class constructor
//-----------------------------------------------------------------------------
Mill::Mill()
{
@ -27,8 +27,8 @@ Mill::Mill()
}
//-----------------------------------------------------------------------------
// Name: ~Mill()
// Desc: Mill class destructor
// ~Mill()
// Mill class destructor
//-----------------------------------------------------------------------------
Mill::~Mill()
{
@ -36,8 +36,8 @@ Mill::~Mill()
}
//-----------------------------------------------------------------------------
// Name: deleteArrays()
// Desc: Deletes all arrays the Mill class has created.
// deleteArrays()
// Deletes all arrays the Mill class has created.
//-----------------------------------------------------------------------------
void Mill::exit()
{
@ -49,8 +49,8 @@ void Mill::exit()
}
//-----------------------------------------------------------------------------
// Name: beginNewGame()
// Desc: Reinitializes the Mill object.
// beginNewGame()
// Reinitializes the Mill object.
//-----------------------------------------------------------------------------
void Mill::beginNewGame(MillAI *firstPlayerAI, MillAI *secondPlayerAI, int currentPlayer)
{
@ -83,8 +83,8 @@ void Mill::beginNewGame(MillAI *firstPlayerAI, MillAI *secondPlayerAI, int curre
}
//-----------------------------------------------------------------------------
// Name: startSettingPhase()
// Desc:
// startSettingPhase()
//
//-----------------------------------------------------------------------------
bool Mill::startSettingPhase(MillAI *firstPlayerAI, MillAI *secondPlayerAI, int currentPlayer, bool settingPhase)
{
@ -96,8 +96,8 @@ bool Mill::startSettingPhase(MillAI *firstPlayerAI, MillAI *secondPlayerAI, int
}
//-----------------------------------------------------------------------------
// Name: setUpCalcPossibleMoves()
// Desc: Calculates and set the number of possible moves for the passed player considering the game state stored in the 'board' variable.
// setUpCalcPossibleMoves()
// Calculates and set the number of possible moves for the passed player considering the game state stored in the 'board' variable.
//-----------------------------------------------------------------------------
void Mill::setUpCalcPossibleMoves(Player *player)
{
@ -135,8 +135,8 @@ void Mill::setUpCalcPossibleMoves(Player *player)
}
//-----------------------------------------------------------------------------
// Name: setUpSetWarningAndMill()
// Desc:
// setUpSetWarningAndMill()
//
//-----------------------------------------------------------------------------
void Mill::setUpSetWarningAndMill(unsigned int stone, unsigned int firstNeighbour, unsigned int secondNeighbour)
{
@ -153,8 +153,8 @@ void Mill::setUpSetWarningAndMill(unsigned int stone, unsigned int firstNeighbou
}
//-----------------------------------------------------------------------------
// Name: putPiece()
// Desc: Put a stone onto the board during the setting phase.
// putPiece()
// Put a stone onto the board during the setting phase.
//-----------------------------------------------------------------------------
bool Mill::putPiece(unsigned int pos, int player)
{
@ -235,8 +235,8 @@ bool Mill::putPiece(unsigned int pos, int player)
}
//-----------------------------------------------------------------------------
// Name: settingPhaseHasFinished()
// Desc: This function has to be called when the setting phase has finished.
// settingPhaseHasFinished()
// This function has to be called when the setting phase has finished.
//-----------------------------------------------------------------------------
bool Mill::settingPhaseHasFinished()
{
@ -247,8 +247,8 @@ bool Mill::settingPhaseHasFinished()
}
//-----------------------------------------------------------------------------
// Name: getField()
// Desc: Copy the current board state into the array 'pField'.
// getField()
// Copy the current board state into the array 'pField'.
//-----------------------------------------------------------------------------
bool Mill::getField(int *pField)
{
@ -269,8 +269,8 @@ bool Mill::getField(int *pField)
}
//-----------------------------------------------------------------------------
// Name: getLog()
// Desc: Copy the whole history of moves into the passed arrays, which must be of size [MAX_NUM_MOVES].
// getLog()
// Copy the whole history of moves into the passed arrays, which must be of size [MAX_NUM_MOVES].
//-----------------------------------------------------------------------------
void Mill::getLog(unsigned int &numMovesDone, unsigned int *from, unsigned int *to)
{
@ -285,8 +285,8 @@ void Mill::getLog(unsigned int &numMovesDone, unsigned int *from, unsigned int *
}
//-----------------------------------------------------------------------------
// Name: setNextPlayer()
// Desc: Current player and opponent player are switched in the board struct.
// setNextPlayer()
// Current player and opponent player are switched in the board struct.
//-----------------------------------------------------------------------------
void Mill::setNextPlayer()
{
@ -298,8 +298,8 @@ void Mill::setNextPlayer()
}
//-----------------------------------------------------------------------------
// Name: isCurrentPlayerHuman()
// Desc: Returns true if the current player is not assigned to an AI.
// isCurrentPlayerHuman()
// Returns true if the current player is not assigned to an AI.
//-----------------------------------------------------------------------------
bool Mill::isCurrentPlayerHuman()
{
@ -310,8 +310,8 @@ bool Mill::isCurrentPlayerHuman()
}
//-----------------------------------------------------------------------------
// Name: isOpponentPlayerHuman()
// Desc: Returns true if the opponent player is not assigned to an AI.
// isOpponentPlayerHuman()
// Returns true if the opponent player is not assigned to an AI.
//-----------------------------------------------------------------------------
bool Mill::isOpponentPlayerHuman()
{
@ -322,8 +322,8 @@ bool Mill::isOpponentPlayerHuman()
}
//-----------------------------------------------------------------------------
// Name: setAI()
// Desc: Assigns an AI to a player.
// setAI()
// Assigns an AI to a player.
//-----------------------------------------------------------------------------
void Mill::setAI(int player, MillAI *AI)
{
@ -336,8 +336,8 @@ void Mill::setAI(int player, MillAI *AI)
}
//-----------------------------------------------------------------------------
// Name: getChoiceOfSpecialAI()
// Desc: Returns the move the passed AI would do.
// getChoiceOfSpecialAI()
// Returns the move the passed AI would do.
//-----------------------------------------------------------------------------
void Mill::getChoiceOfSpecialAI(MillAI *AI, unsigned int *pushFrom, unsigned int *pushTo)
{
@ -352,8 +352,8 @@ void Mill::getChoiceOfSpecialAI(MillAI *AI, unsigned int *pushFrom, unsigned int
}
//-----------------------------------------------------------------------------
// Name: getComputersChoice()
// Desc: Returns the move the AI of the current player would do.
// getComputersChoice()
// Returns the move the AI of the current player would do.
//-----------------------------------------------------------------------------
void Mill::getComputersChoice(unsigned int *pushFrom, unsigned int *pushTo)
{
@ -377,8 +377,8 @@ void Mill::getComputersChoice(unsigned int *pushFrom, unsigned int *pushTo)
}
//-----------------------------------------------------------------------------
// Name: isNormalMovePossible()
// Desc: 'Normal' in this context means, by moving the stone along a connection without jumping.
// isNormalMovePossible()
// 'Normal' in this context means, by moving the stone along a connection without jumping.
//-----------------------------------------------------------------------------
bool Mill::isNormalMovePossible(unsigned int from, unsigned int to, Player *player)
{
@ -417,8 +417,8 @@ bool Mill::isNormalMovePossible(unsigned int from, unsigned int to, Player *play
}
//-----------------------------------------------------------------------------
// Name: calcPossibleMoves()
// Desc: ...
// calcPossibleMoves()
// ...
//-----------------------------------------------------------------------------
void Mill::calcPossibleMoves(Player *player)
{
@ -454,8 +454,8 @@ void Mill::calcPossibleMoves(Player *player)
}
//-----------------------------------------------------------------------------
// Name: setWarningAndMill()
// Desc:
// setWarningAndMill()
//
//-----------------------------------------------------------------------------
void Mill::setWarningAndMill(unsigned int stone, unsigned int firstNeighbour, unsigned int secondNeighbour, bool isNewStone)
{
@ -481,8 +481,8 @@ void Mill::setWarningAndMill(unsigned int stone, unsigned int firstNeighbour, un
}
//-----------------------------------------------------------------------------
// Name: updateMillsAndWarnings()
// Desc:
// updateMillsAndWarnings()
//
//-----------------------------------------------------------------------------
void Mill::updateMillsAndWarnings(unsigned int newStone)
{
@ -519,8 +519,8 @@ void Mill::updateMillsAndWarnings(unsigned int newStone)
}
//-----------------------------------------------------------------------------
// Name: doMove()
// Desc:
// doMove()
//
//-----------------------------------------------------------------------------
bool Mill::doMove(unsigned int pushFrom, unsigned int pushTo)
{
@ -654,8 +654,8 @@ bool Mill::doMove(unsigned int pushFrom, unsigned int pushTo)
}
//-----------------------------------------------------------------------------
// Name: setCurrentGameState()
// Desc: Set an arbitrary game state as the current one.
// setCurrentGameState()
// Set an arbitrary game state as the current one.
//-----------------------------------------------------------------------------
bool Mill::setCurrentGameState(fieldStruct *curState)
{
@ -677,8 +677,8 @@ bool Mill::setCurrentGameState(fieldStruct *curState)
}
//-----------------------------------------------------------------------------
// Name: compareWithField()
// Desc: Compares the current 'board' variable with the passed one. 'stoneMoveAble[]' is ignored.
// compareWithField()
// Compares the current 'board' variable with the passed one. 'stoneMoveAble[]' is ignored.
//-----------------------------------------------------------------------------
bool Mill::compareWithField(fieldStruct *compareField)
{
@ -745,8 +745,8 @@ bool Mill::compareWithField(fieldStruct *compareField)
}
//-----------------------------------------------------------------------------
// Name: comparePlayers()
// Desc: Compares the two passed players and returns false if they differ.
// comparePlayers()
// Compares the two passed players and returns false if they differ.
//-----------------------------------------------------------------------------
bool Mill::comparePlayers(Player *playerA, Player *playerB)
{
@ -785,8 +785,8 @@ bool Mill::comparePlayers(Player *playerA, Player *playerB)
}
//-----------------------------------------------------------------------------
// Name: printBoard()
// Desc: Calls the printBoard() function of the current board.
// printBoard()
// Calls the printBoard() function of the current board.
// Prints the current game state on the screen.
//-----------------------------------------------------------------------------
void Mill::printBoard()
@ -795,8 +795,8 @@ void Mill::printBoard()
}
//-----------------------------------------------------------------------------
// Name: undoMove()
// Desc: Sets the initial board as the current one and apply all (minus one) moves from the move history.
// undoMove()
// Sets the initial board as the current one and apply all (minus one) moves from the move history.
//-----------------------------------------------------------------------------
void Mill::undoMove(void)
{
@ -832,8 +832,8 @@ void Mill::undoMove(void)
}
//-----------------------------------------------------------------------------
// Name: calcNumberOfRestingStones()
// Desc:
// calcNumberOfRestingStones()
//
//-----------------------------------------------------------------------------
void Mill::calcNumberOfRestingStones(int &numWhiteStonesResting, int &numBlackStonesResting)
{
@ -844,4 +844,4 @@ void Mill::calcNumberOfRestingStones(int &numWhiteStonesResting, int &numBlackSt
numWhiteStonesResting = fieldStruct::numStonesPerPlayer - field.oppPlayer->numStonesMissing - field.oppPlayer->numStones;
numBlackStonesResting = fieldStruct::numStonesPerPlayer - field.curPlayer->numStonesMissing - field.curPlayer->numStones;
}
}
}

View File

@ -19,10 +19,8 @@
using namespace std;
/*** Konstanten ******************************************************/
#define MAX_NUM_MOVES 10000
/*** Makros ******************************************************/
#define SAFE_DELETE(p) \
{ \
if (p) \
@ -31,6 +29,7 @@ using namespace std;
(p) = nullptr; \
} \
}
#define SAFE_DELETE_ARRAY(p) \
{ \
if (p) \
@ -40,7 +39,6 @@ using namespace std;
} \
}
/*** Klassen *********************************************************/
class Mill
{

View File

@ -11,8 +11,8 @@
using namespace std;
//-----------------------------------------------------------------------------
// Name: printBoard()
// Desc:
// printBoard()
//
//-----------------------------------------------------------------------------
void fieldStruct::printBoard()
{
@ -55,8 +55,8 @@ void fieldStruct::printBoard()
}
//-----------------------------------------------------------------------------
// Name: GetCharFromStone()
// Desc:
// GetCharFromStone()
//
//-----------------------------------------------------------------------------
char fieldStruct::GetCharFromStone(int stone)
{
@ -78,8 +78,8 @@ char fieldStruct::GetCharFromStone(int stone)
}
//-----------------------------------------------------------------------------
// Name: copyBoard()
// Desc: Only copies the values without array creation.
// copyBoard()
// Only copies the values without array creation.
//-----------------------------------------------------------------------------
void fieldStruct::copyBoard(fieldStruct *destination)
{
@ -108,8 +108,8 @@ void fieldStruct::copyBoard(fieldStruct *destination)
}
//-----------------------------------------------------------------------------
// Name: copyPlayer()
// Desc: Only copies the values without array creation.
// copyPlayer()
// Only copies the values without array creation.
//-----------------------------------------------------------------------------
void Player::copyPlayer(Player *destination)
{
@ -129,8 +129,8 @@ void Player::copyPlayer(Player *destination)
}
//-----------------------------------------------------------------------------
// Name: createBoard()
// Desc: Creates, but doesn't initialize, the arrays of the of the passed board structure.
// createBoard()
// Creates, but doesn't initialize, the arrays of the of the passed board structure.
//-----------------------------------------------------------------------------
void fieldStruct::createBoard()
{
@ -221,8 +221,8 @@ void fieldStruct::createBoard()
}
//-----------------------------------------------------------------------------
// Name: deleteBoard()
// Desc: ...
// deleteBoard()
// ...
//-----------------------------------------------------------------------------
void fieldStruct::deleteBoard()
{
@ -231,8 +231,8 @@ void fieldStruct::deleteBoard()
}
//-----------------------------------------------------------------------------
// Name: setConnection()
// Desc:
// setConnection()
//
//-----------------------------------------------------------------------------
inline void fieldStruct::setConnection(unsigned int index, int firstDirection, int secondDirection, int thirdDirection, int fourthDirection)
{
@ -243,8 +243,8 @@ inline void fieldStruct::setConnection(unsigned int index, int firstDirection, i
}
//-----------------------------------------------------------------------------
// Name: setNeighbour()
// Desc:
// setNeighbour()
//
//-----------------------------------------------------------------------------
inline void fieldStruct::setNeighbour(unsigned int index, unsigned int firstNeighbour0, unsigned int secondNeighbour0, unsigned int firstNeighbour1, unsigned int secondNeighbour1)
{
@ -252,4 +252,4 @@ inline void fieldStruct::setNeighbour(unsigned int index, unsigned int firstNeig
neighbour[index][0][1] = secondNeighbour0;
neighbour[index][1][0] = firstNeighbour1;
neighbour[index][1][1] = secondNeighbour1;
}
}

View File

@ -14,7 +14,7 @@
//using namespace std;
/*** Konstanten ******************************************************/
#define MAX_NUM_POS_MOVES (3 * 18) // not (9 * 4) = 36 since the possibilities with 3 stones are more
#define SAFE_DELETE(p) \
@ -26,7 +26,7 @@
} \
}
/*** Klassen *********************************************************/
class Player
{

View File

@ -9,8 +9,8 @@
#include "miniMaxAI.h"
//-----------------------------------------------------------------------------
// Name: MiniMaxAI()
// Desc: MiniMaxAI class constructor
// MiniMaxAI()
// MiniMaxAI class constructor
//-----------------------------------------------------------------------------
MiniMaxAI::MiniMaxAI()
{
@ -18,16 +18,16 @@ MiniMaxAI::MiniMaxAI()
}
//-----------------------------------------------------------------------------
// Name: ~MiniMaxAI()
// Desc: MiniMaxAI class destructor
// ~MiniMaxAI()
// MiniMaxAI class destructor
//-----------------------------------------------------------------------------
MiniMaxAI::~MiniMaxAI()
{
}
//-----------------------------------------------------------------------------
// Name: play()
// Desc:
// play()
//
//-----------------------------------------------------------------------------
void MiniMaxAI::play(fieldStruct *theField, unsigned int *pushFrom, unsigned int *pushTo)
{
@ -85,8 +85,8 @@ void MiniMaxAI::play(fieldStruct *theField, unsigned int *pushFrom, unsigned int
}
//-----------------------------------------------------------------------------
// Name: setSearchDepth()
// Desc:
// setSearchDepth()
//
//-----------------------------------------------------------------------------
void MiniMaxAI::setSearchDepth(unsigned int depth)
{
@ -94,8 +94,8 @@ void MiniMaxAI::setSearchDepth(unsigned int depth)
}
//-----------------------------------------------------------------------------
// Name: prepareBestChoiceCalculation()
// Desc:
// prepareBestChoiceCalculation()
//
//-----------------------------------------------------------------------------
void MiniMaxAI::prepareBestChoiceCalculation()
{
@ -105,8 +105,8 @@ void MiniMaxAI::prepareBestChoiceCalculation()
}
//-----------------------------------------------------------------------------
// Name: getPossSettingPhase()
// Desc:
// getPossSettingPhase()
//
//-----------------------------------------------------------------------------
unsigned int *MiniMaxAI::getPossSettingPhase(unsigned int *numPossibilities, void **pPossibilities)
{
@ -131,8 +131,8 @@ unsigned int *MiniMaxAI::getPossSettingPhase(unsigned int *numPossibilities, voi
}
//-----------------------------------------------------------------------------
// Name: getPossNormalMove()
// Desc:
// getPossNormalMove()
//
//-----------------------------------------------------------------------------
unsigned int *MiniMaxAI::getPossNormalMove(unsigned int *numPossibilities, void **pPossibilities)
{
@ -186,8 +186,8 @@ unsigned int *MiniMaxAI::getPossNormalMove(unsigned int *numPossibilities, void
}
//-----------------------------------------------------------------------------
// Name: getPossStoneRemove()
// Desc:
// getPossStoneRemove()
//
//-----------------------------------------------------------------------------
unsigned int *MiniMaxAI::getPossStoneRemove(unsigned int *numPossibilities, void **pPossibilities)
{
@ -213,8 +213,8 @@ unsigned int *MiniMaxAI::getPossStoneRemove(unsigned int *numPossibilities, void
}
//-----------------------------------------------------------------------------
// Name: getPossibilities()
// Desc:
// getPossibilities()
//
//-----------------------------------------------------------------------------
unsigned int *MiniMaxAI::getPossibilities(unsigned int threadNo, unsigned int *numPossibilities, bool *opponentsMove, void **pPossibilities)
{
@ -237,8 +237,8 @@ unsigned int *MiniMaxAI::getPossibilities(unsigned int threadNo, unsigned int *n
}
//-----------------------------------------------------------------------------
// Name: getValueOfSituation()
// Desc:
// getValueOfSituation()
//
//-----------------------------------------------------------------------------
void MiniMaxAI::getValueOfSituation(unsigned int threadNo, float &floatValue, TwoBit &shortValue)
{
@ -247,16 +247,16 @@ void MiniMaxAI::getValueOfSituation(unsigned int threadNo, float &floatValue, Tw
}
//-----------------------------------------------------------------------------
// Name: deletePossibilities()
// Desc:
// deletePossibilities()
//
//-----------------------------------------------------------------------------
void MiniMaxAI::deletePossibilities(unsigned int threadNo, void *pPossibilities)
{
}
//-----------------------------------------------------------------------------
// Name: undo()
// Desc:
// undo()
//
//-----------------------------------------------------------------------------
void MiniMaxAI::undo(unsigned int threadNo, unsigned int idPossibility, bool opponentsMove, void *pBackup, void *pPossibilities)
{
@ -290,8 +290,8 @@ void MiniMaxAI::undo(unsigned int threadNo, unsigned int idPossibility, bool opp
}
//-----------------------------------------------------------------------------
// Name: setWarning()
// Desc:
// setWarning()
//
//-----------------------------------------------------------------------------
inline void MiniMaxAI::setWarning(unsigned int stoneOne, unsigned int stoneTwo, unsigned int stoneThree)
{
@ -365,8 +365,8 @@ inline void MiniMaxAI::setWarning(unsigned int stoneOne, unsigned int stoneTwo,
}
//-----------------------------------------------------------------------------
// Name: updateWarning()
// Desc:
// updateWarning()
//
//-----------------------------------------------------------------------------
inline void MiniMaxAI::updateWarning(unsigned int firstStone, unsigned int secondStone)
{
@ -397,8 +397,8 @@ inline void MiniMaxAI::updateWarning(unsigned int firstStone, unsigned int secon
}
//-----------------------------------------------------------------------------
// Name: updatePossibleMoves()
// Desc:
// updatePossibleMoves()
//
//-----------------------------------------------------------------------------
inline void MiniMaxAI::updatePossibleMoves(unsigned int stone, Player *stoneOwner, bool stoneRemoved, unsigned int ignoreStone)
{
@ -446,8 +446,8 @@ inline void MiniMaxAI::updatePossibleMoves(unsigned int stone, Player *stoneOwne
}
//-----------------------------------------------------------------------------
// Name: setStone()
// Desc:
// setStone()
//
//-----------------------------------------------------------------------------
inline void MiniMaxAI::setStone(unsigned int to, Backup *backup)
{
@ -474,8 +474,8 @@ inline void MiniMaxAI::setStone(unsigned int to, Backup *backup)
}
//-----------------------------------------------------------------------------
// Name: normalMove()
// Desc:
// normalMove()
//
//-----------------------------------------------------------------------------
inline void MiniMaxAI::normalMove(unsigned int from, unsigned int to, Backup *backup)
{
@ -498,8 +498,8 @@ inline void MiniMaxAI::normalMove(unsigned int from, unsigned int to, Backup *ba
}
//-----------------------------------------------------------------------------
// Name: removeStone()
// Desc:
// removeStone()
//
//-----------------------------------------------------------------------------
inline void MiniMaxAI::removeStone(unsigned int from, Backup *backup)
{
@ -527,8 +527,8 @@ inline void MiniMaxAI::removeStone(unsigned int from, Backup *backup)
}
//-----------------------------------------------------------------------------
// Name: move()
// Desc:
// move()
//
//-----------------------------------------------------------------------------
void MiniMaxAI::move(unsigned int threadNo, unsigned int idPossibility, bool opponentsMove, void **pBackup, void *pPossibilities)
{
@ -596,8 +596,8 @@ void MiniMaxAI::move(unsigned int threadNo, unsigned int idPossibility, bool opp
}
//-----------------------------------------------------------------------------
// Name: printMoveInformation()
// Desc:
// printMoveInformation()
//
//-----------------------------------------------------------------------------
void MiniMaxAI::printMoveInformation(unsigned int threadNo, unsigned int idPossibility, void *pPossibilities)
{

View File

@ -9,8 +9,8 @@
#include "miniMax.h"
//-----------------------------------------------------------------------------
// Name: MiniMax()
// Desc: MiniMax class constructor
// MiniMax()
// MiniMax class constructor
//-----------------------------------------------------------------------------
MiniMax::MiniMax()
{
@ -73,8 +73,8 @@ MiniMax::MiniMax()
}
//-----------------------------------------------------------------------------
// Name: ~MiniMax()
// Desc: MiniMax class destructor
// ~MiniMax()
// MiniMax class destructor
//-----------------------------------------------------------------------------
MiniMax::~MiniMax()
{
@ -84,8 +84,8 @@ MiniMax::~MiniMax()
}
//-----------------------------------------------------------------------------
// Name: falseOrStop()
// Desc:
// falseOrStop()
//
//-----------------------------------------------------------------------------
bool MiniMax::falseOrStop()
{
@ -96,8 +96,8 @@ bool MiniMax::falseOrStop()
}
//-----------------------------------------------------------------------------
// Name: getBestChoice()
// Desc: Returns the best choice if the database has been opened and calculates the best choice for that if database is not open.
// getBestChoice()
// Returns the best choice if the database has been opened and calculates the best choice for that if database is not open.
//-----------------------------------------------------------------------------
void *MiniMax::getBestChoice(unsigned int tilLevel, unsigned int *choice, unsigned int maximumNumberOfBranches)
{
@ -128,8 +128,8 @@ void *MiniMax::getBestChoice(unsigned int tilLevel, unsigned int *choice, unsign
}
//-----------------------------------------------------------------------------
// Name: calculateDatabase()
// Desc: Calculates the database, which must be already open.
// calculateDatabase()
// Calculates the database, which must be already open.
//-----------------------------------------------------------------------------
void MiniMax::calculateDatabase(unsigned int maxDepthOfTree, bool onlyPrepLayer)
{
@ -214,8 +214,8 @@ void MiniMax::calculateDatabase(unsigned int maxDepthOfTree, bool onlyPrepLayer)
}
//-----------------------------------------------------------------------------
// Name: calcLayer()
// Desc:
// calcLayer()
//
//-----------------------------------------------------------------------------
bool MiniMax::calcLayer(unsigned int layerNumber)
{
@ -271,8 +271,8 @@ bool MiniMax::calcLayer(unsigned int layerNumber)
}
//-----------------------------------------------------------------------------
// Name: pauseDatabaseCalculation()
// Desc:
// pauseDatabaseCalculation()
//
//-----------------------------------------------------------------------------
void MiniMax::pauseDatabaseCalculation()
{
@ -280,8 +280,8 @@ void MiniMax::pauseDatabaseCalculation()
}
//-----------------------------------------------------------------------------
// Name: cancelDatabaseCalculation()
// Desc:
// cancelDatabaseCalculation()
//
//-----------------------------------------------------------------------------
void MiniMax::cancelDatabaseCalculation()
{
@ -290,8 +290,8 @@ void MiniMax::cancelDatabaseCalculation()
}
//-----------------------------------------------------------------------------
// Name: wasDatabaseCalculationCancelled()
// Desc:
// wasDatabaseCalculationCancelled()
//
//-----------------------------------------------------------------------------
bool MiniMax::wasDatabaseCalculationCancelled()
{

View File

@ -35,11 +35,11 @@ using namespace std; // use standard library namespace
/*** Wiki ***************************************************************************************************************************
player:
layer: The states are divided in layers. For example depending on number of stones on the board.
state: A unique game state reprensiting a current game situation.
state: A unique game state representing a current game situation.
situation: Used as synonym to state.
knot: Each knot of the graph corresponds to a game state. The knots are connected by possible valid moves.
ply info: Number of plies/moves necessary to win the game.
state adress: A state is identified by the corresponding layer and the state number within the layer.
state address: A state is identified by the corresponding layer and the state number within the layer.
short knot value: Each knot/state can have the value SKV_VALUE_INVALID, SKV_VALUE_GAME_LOST, SKV_VALUE_GAME_DRAWN or SKV_VALUE_GAME_WON.
float point knot value: Each knot/state can be evaluated by a floating point value. High positive values represents winning situations. Negative values stand for loosing situations.
database: The database contains the arrays with the short knot values and the ply infos.
@ -133,7 +133,7 @@ public:
/*** typedefines ***************************************************************************************************************************/
typedef unsigned char TwoBit; // 2-Bit variable ranging from 0 to 3
typedef unsigned short PlyInfoVarType; // 2 Bytes for saving the ply info
typedef unsigned char CountArrayVarType; // 1 Byte for counting predesseccors
typedef unsigned char CountArrayVarType; // 1 Byte for counting predecessors
typedef unsigned int StateNumberVarType; // 4 Bytes for addressing states within a layer
/*** protected structures ********************************************************************************************************************/
@ -148,7 +148,7 @@ public:
struct PlyInfoFileHeader
{
bool plyInfoCompleted; // true if ply innformation has been calculated for all game states
bool plyInfoCompleted; // true if ply information has been calculated for all game states
unsigned int numLayers; // number of layers
unsigned int headerCode; // = PLYINFO_HEADER_CODE
unsigned int headerAndPlyInfosSize; // size in bytes of this struct plus ...
@ -171,8 +171,8 @@ public:
bool layerIsLoaded; // the array shortKnotValueByte[] exists in memory. does not necessary mean that it contains only valid values
bool layerIsCompletedAndInFile; // the array shortKnotValueByte[] contains only fully calculated valid values
long long layerOffset; // position of this struct in the short knot value file
unsigned int numSuccLayers; // number of succeding layers. states of other layers are connected by a move of a player
unsigned int succLayers[MAX_NUM_PRED_LAYERS]; // array containg the layer ids of the succeding layers
unsigned int numSuccLayers; // number of succeeding layers. states of other layers are connected by a move of a player
unsigned int succLayers[MAX_NUM_PRED_LAYERS]; // array containing the layer ids of the succeeding layers
unsigned int partnerLayer; // layer id relevant when switching current and opponent player
StateNumberVarType knotsInLayer; // number of knots of the corresponding layer
StateNumberVarType numWonStates; // number of won states in this layer
@ -180,7 +180,7 @@ public:
StateNumberVarType numDrawnStates; // number of drawn states in this layer
StateNumberVarType numInvalidStates; // number of invalid states in this layer
unsigned int sizeInBytes; // (knotsInLayer + 3) / 4
TwoBit *shortKnotValueByte; // array of size [sizeInBytes] containg the short knot values
TwoBit *shortKnotValueByte; // array of size [sizeInBytes] containing the short knot values
//compressorClass::compressedArrayClass * skvCompressed; // compressed array containing the short knot values
void *skvCompressed; // dummy pointer for padding
};
@ -696,7 +696,7 @@ private:
// variables, which are constant during database calculation
int verbosity = 2; // output detail level. default is 2
unsigned char skvPerspectiveMatrix[4][2]; // [short knot value][current or opponent player] - A winning situation is a loosing situation for the opponent and so on ...
bool calcDatabase = false; // true, if the database is currently beeing calculated
bool calcDatabase = false; // true, if the database is currently being calculated
HANDLE hFileShortKnotValues = nullptr; // handle of the file for the short knot value
HANDLE hFilePlyInfo = nullptr; // handle of the file for the ply info
SkvFileHeader skvfHeader; // short knot value file header
@ -718,7 +718,7 @@ private:
LONGLONG memoryUsed2 = 0; // memory in bytes used for storing: ply information, short knot value and ...
LONGLONG numStatesProcessed = 0; //
unsigned int maxNumBranches = 0; // maximum number of branches/moves
unsigned int depthOfFullTree = 0; // maxumim search depth
unsigned int depthOfFullTree = 0; // maximum search depth
unsigned int curCalculatedLayer = 0; // id of the currently calculated layer
unsigned int curCalculationActionId = 0; // one of ...
bool layerInDatabase = false; // true if the current considered layer has already been calculated and stored in the database
@ -731,10 +731,10 @@ private:
// unsigned int compressionAlgorithmnId = 0; // 0 or one of the COMPRESSOR_ALG_... constants
// database io operations per second
long long numReadSkvOperations = 0; // number of read operations done since start of the programm
long long numWriteSkvOperations = 0; // number of write operations done since start of the programm
long long numReadPlyOperations = 0; // number of read operations done since start of the programm
long long numWritePlyOperations = 0; // number of write operations done since start of the programm
long long numReadSkvOperations = 0; // number of read operations done since start of the program
long long numWriteSkvOperations = 0; // number of write operations done since start of the program
long long numReadPlyOperations = 0; // number of read operations done since start of the program
long long numWritePlyOperations = 0; // number of write operations done since start of the program
LARGE_INTEGER readSkvInterval; // time of interval for read operations
LARGE_INTEGER writeSkvInterval; // ''
LARGE_INTEGER readPlyInterval; // ''

View File

@ -20,7 +20,7 @@
#define VALUE_GAME_LOST -1000.0f
#define VALUE_GAME_WON 1000.0f
/*** Klassen *********************************************************/
class MiniMaxAI : public MillAI, MiniMax
{
protected:

View File

@ -9,8 +9,8 @@
#include "miniMax.h"
//-----------------------------------------------------------------------------
// Name: calcKnotValuesByAlphaBeta()
// Desc: return value is true if calculation is stopped either by user or by an error
// calcKnotValuesByAlphaBeta()
// return value is true if calculation is stopped either by user or by an error
//-----------------------------------------------------------------------------
bool MiniMax::calcKnotValuesByAlphaBeta(unsigned int layerNumber)
{
@ -41,8 +41,8 @@ bool MiniMax::calcKnotValuesByAlphaBeta(unsigned int layerNumber)
}
//-----------------------------------------------------------------------------
// Name: saveKnotValueInDatabase()
// Desc:
// saveKnotValueInDatabase()
//
//-----------------------------------------------------------------------------
void MiniMax::alphaBetaSaveInDatabase(unsigned int threadNo, unsigned int layerNumber, unsigned int stateNumber, TwoBit knotValue, PlyInfoVarType plyValue, bool invertValue)
{
@ -83,8 +83,8 @@ void MiniMax::alphaBetaSaveInDatabase(unsigned int threadNo, unsigned int layerN
}
//-----------------------------------------------------------------------------
// Name: initAlphaBeta()
// Desc: The function setSituation is called for each state to mark the invalid ones.
// initAlphaBeta()
// The function setSituation is called for each state to mark the invalid ones.
//-----------------------------------------------------------------------------
bool MiniMax::initAlphaBeta(AlphaBetaGlobalVars &alphaBetaVars)
{
@ -95,7 +95,13 @@ bool MiniMax::initAlphaBeta(AlphaBetaGlobalVars &alphaBetaVars)
stringstream ssInvArrayFilePath; //
// set current processed layer number
PRINT(1, this, endl << " *** Signing of invalid states for layer " << alphaBetaVars.layerNumber << " (" << (getOutputInformation(alphaBetaVars.layerNumber)) << ") which has " << layerStats[alphaBetaVars.layerNumber].knotsInLayer << " knots ***");
PRINT(1, this,
endl <<
" *** Signing of invalid states for layer " <<
alphaBetaVars.layerNumber << " (" <<
(getOutputInformation(alphaBetaVars.layerNumber)) <<
") which has " << layerStats[alphaBetaVars.layerNumber].knotsInLayer <<
" knots ***");
// file names
ssInvArrayDirectory.str("");
@ -157,8 +163,8 @@ bool MiniMax::initAlphaBeta(AlphaBetaGlobalVars &alphaBetaVars)
}
//-----------------------------------------------------------------------------
// Name: initAlphaBetaThreadProc()
// Desc: set short knot value to SKV_VALUE_INVALID, ply info to PLYINFO_VALUE_INVALID and knotAlreadyCalculated to true or false, whether setSituation() returns true or false
// initAlphaBetaThreadProc()
// set short knot value to SKV_VALUE_INVALID, ply info to PLYINFO_VALUE_INVALID and knotAlreadyCalculated to true or false, whether setSituation() returns true or false
//-----------------------------------------------------------------------------
DWORD MiniMax::initAlphaBetaThreadProc(void *pParameter, int index)
{
@ -224,8 +230,8 @@ DWORD MiniMax::initAlphaBetaThreadProc(void *pParameter, int index)
}
//-----------------------------------------------------------------------------
// Name: runAlphaBeta()
// Desc:
// runAlphaBeta()
//
//-----------------------------------------------------------------------------
bool MiniMax::runAlphaBeta(AlphaBetaGlobalVars &alphaBetaVars)
{
@ -271,8 +277,8 @@ bool MiniMax::runAlphaBeta(AlphaBetaGlobalVars &alphaBetaVars)
}
//-----------------------------------------------------------------------------
// Name: runAlphaBetaThreadProc()
// Desc:
// runAlphaBetaThreadProc()
//
//-----------------------------------------------------------------------------
DWORD MiniMax::runAlphaBetaThreadProc(void *pParameter, int index)
{
@ -312,8 +318,8 @@ DWORD MiniMax::runAlphaBetaThreadProc(void *pParameter, int index)
}
//-----------------------------------------------------------------------------
// Name: letTheTreeGrow()
// Desc:
// letTheTreeGrow()
//
//-----------------------------------------------------------------------------
void MiniMax::letTheTreeGrow(Knot *knot, RunAlphaBetaVars *rabVars, unsigned int tilLevel, float alpha, float beta)
{
@ -353,7 +359,7 @@ void MiniMax::letTheTreeGrow(Knot *knot, RunAlphaBetaVars *rabVars, unsigned int
if (alphaBetaTryDataBase(knot, rabVars, tilLevel, layerNumber, stateNumber))
return;
// get number of possiblities
// get number of possibilities
idPossibility = getPossibilities(rabVars->curThreadNo, &knot->numPossibilities, &knot->isOpponentLevel, &pPossibilities);
// unable to move
@ -379,7 +385,7 @@ void MiniMax::letTheTreeGrow(Knot *knot, RunAlphaBetaVars *rabVars, unsigned int
// calculate value of knot - its the value of the best branch
alphaBetaCalcKnotValue(knot);
// calc ply info
// calculate ply info
alphaBetaCalcPlyInfo(knot);
// select randomly one of the best moves, if they are equivalent
@ -393,8 +399,8 @@ void MiniMax::letTheTreeGrow(Knot *knot, RunAlphaBetaVars *rabVars, unsigned int
}
//-----------------------------------------------------------------------------
// Name: alphaBetaTryDataBase()
// Desc:
// alphaBetaTryDataBase()
//
// 1 - Determines layerNumber and stateNumber for the given game situation.
// 2 - Look into database if knot value and ply info are already calculated. If so sets knot->shortValue, knot->floatValue and knot->plyInfo.
// CAUTION: knot->isOpponentLevel must be set and valid.
@ -409,7 +415,7 @@ bool MiniMax::alphaBetaTryDataBase(Knot *knot, RunAlphaBetaVars *rabVars, unsign
// use database ?
if (hFilePlyInfo != nullptr && hFileShortKnotValues != nullptr && (calcDatabase || layerInDatabase)) {
// situation already existend in database ?
// situation already existed in database ?
readKnotValueFromDatabase(rabVars->curThreadNo, layerNumber, stateNumber, shortKnotValue, invalidLayerOrStateNumber, subLayerInDatabaseAndCompleted);
readPlyInfoFromDatabase(layerNumber, stateNumber, plyInfo);
@ -444,8 +450,8 @@ bool MiniMax::alphaBetaTryDataBase(Knot *knot, RunAlphaBetaVars *rabVars, unsign
}
//-----------------------------------------------------------------------------
// Name: alphaBetaTryPossibilites()
// Desc:
// alphaBetaTryPossibilites()
//
//-----------------------------------------------------------------------------
void MiniMax::alphaBetaTryPossibilites(Knot *knot, RunAlphaBetaVars *rabVars, unsigned int tilLevel, unsigned int *idPossibility, void *pPossibilities, unsigned int &maxWonfreqValuesSubMoves, float &alpha, float &beta)
{
@ -495,7 +501,7 @@ void MiniMax::alphaBetaTryPossibilites(Knot *knot, RunAlphaBetaVars *rabVars, un
if (hFileShortKnotValues != nullptr && tilLevel + 1 >= depthOfFullTree)
continue;
// alpha beta algorithmn
// alpha beta algorithm
if (!knot->isOpponentLevel) {
if (knot->branches[curPoss].floatValue >= beta) {
knot->numPossibilities = curPoss + 1;
@ -522,8 +528,8 @@ void MiniMax::alphaBetaTryPossibilites(Knot *knot, RunAlphaBetaVars *rabVars, un
}
//-----------------------------------------------------------------------------
// Name: alphaBetaCalcKnotValue()
// Desc:
// alphaBetaCalcKnotValue()
//
//-----------------------------------------------------------------------------
void MiniMax::alphaBetaCalcKnotValue(Knot *knot)
{
@ -557,8 +563,8 @@ void MiniMax::alphaBetaCalcKnotValue(Knot *knot)
}
//-----------------------------------------------------------------------------
// Name: alphaBetaCalcPlyInfo()
// Desc:
// alphaBetaCalcPlyInfo()
//
//-----------------------------------------------------------------------------
void MiniMax::alphaBetaCalcPlyInfo(Knot *knot)
{
@ -622,8 +628,8 @@ void MiniMax::alphaBetaCalcPlyInfo(Knot *knot)
}
//-----------------------------------------------------------------------------
// Name: alphaBetaChooseBestMove()
// Desc: select randomly one of the best moves, if they are equivalent
// alphaBetaChooseBestMove()
// select randomly one of the best moves, if they are equivalent
//-----------------------------------------------------------------------------
void MiniMax::alphaBetaChooseBestMove(Knot *knot, RunAlphaBetaVars *rabVars, unsigned int tilLevel, unsigned int *idPossibility, unsigned int maxWonfreqValuesSubMoves)
{
@ -660,7 +666,7 @@ void MiniMax::alphaBetaChooseBestMove(Knot *knot, RunAlphaBetaVars *rabVars, uns
}
}
}
// conventionell mini-max algorithm
// conventional mini-max algorithm
} else {
dif = knot->branches[i].floatValue - knot->floatValue;
dif = (dif > 0) ? dif : -1.0f * dif;

View File

@ -12,8 +12,8 @@
#pragma warning(disable: 4706)
//-----------------------------------------------------------------------------
// Name: ~MiniMax()
// Desc: MiniMax class destructor
// ~MiniMax()
// MiniMax class destructor
//-----------------------------------------------------------------------------
void MiniMax::closeDatabase()
{
@ -35,8 +35,8 @@ void MiniMax::closeDatabase()
}
//-----------------------------------------------------------------------------
// Name: unloadPlyInfo()
// Desc:
// unloadPlyInfo()
//
//-----------------------------------------------------------------------------
void MiniMax::unloadPlyInfo(unsigned int layerNumber)
{
@ -48,8 +48,8 @@ void MiniMax::unloadPlyInfo(unsigned int layerNumber)
}
//-----------------------------------------------------------------------------
// Name: unloadLayer()
// Desc:
// unloadLayer()
//
//-----------------------------------------------------------------------------
void MiniMax::unloadLayer(unsigned int layerNumber)
{
@ -61,8 +61,8 @@ void MiniMax::unloadLayer(unsigned int layerNumber)
}
//-----------------------------------------------------------------------------
// Name: unloadAllPlyInfos()
// Desc:
// unloadAllPlyInfos()
//
//-----------------------------------------------------------------------------
void MiniMax::unloadAllPlyInfos()
{
@ -72,8 +72,8 @@ void MiniMax::unloadAllPlyInfos()
}
//-----------------------------------------------------------------------------
// Name: unloadAllLayers()
// Desc:
// unloadAllLayers()
//
//-----------------------------------------------------------------------------
void MiniMax::unloadAllLayers()
{
@ -83,8 +83,8 @@ void MiniMax::unloadAllLayers()
}
//-----------------------------------------------------------------------------
// Name: saveBytesToFile()
// Desc:
// saveBytesToFile()
//
//-----------------------------------------------------------------------------
void MiniMax::saveBytesToFile(HANDLE hFile, long long offset, unsigned int numBytes, void *pBytes)
{
@ -116,8 +116,8 @@ void MiniMax::saveBytesToFile(HANDLE hFile, long long offset, unsigned int numBy
}
//-----------------------------------------------------------------------------
// Name: loadBytesFromFile()
// Desc:
// loadBytesFromFile()
//
//-----------------------------------------------------------------------------
void MiniMax::loadBytesFromFile(HANDLE hFile, long long offset, unsigned int numBytes, void *pBytes)
{
@ -150,8 +150,8 @@ void MiniMax::loadBytesFromFile(HANDLE hFile, long long offset, unsigned int num
}
//-----------------------------------------------------------------------------
// Name: isCurrentStateInDatabase()
// Desc:
// isCurrentStateInDatabase()
//
//-----------------------------------------------------------------------------
bool MiniMax::isCurrentStateInDatabase(unsigned int threadNo)
{
@ -166,8 +166,8 @@ bool MiniMax::isCurrentStateInDatabase(unsigned int threadNo)
}
//-----------------------------------------------------------------------------
// Name: saveHeader()
// Desc:
// saveHeader()
//
//-----------------------------------------------------------------------------
void MiniMax::saveHeader(SkvFileHeader *dbH, LayerStats *lStats)
{
@ -178,8 +178,8 @@ void MiniMax::saveHeader(SkvFileHeader *dbH, LayerStats *lStats)
}
//-----------------------------------------------------------------------------
// Name: saveHeader()
// Desc:
// saveHeader()
//
//-----------------------------------------------------------------------------
void MiniMax::saveHeader(PlyInfoFileHeader *piH, PlyInfo *pInfo)
{
@ -190,8 +190,8 @@ void MiniMax::saveHeader(PlyInfoFileHeader *piH, PlyInfo *pInfo)
}
//-----------------------------------------------------------------------------
// Name: openDatabase()
// Desc:
// openDatabase()
//
//-----------------------------------------------------------------------------
bool MiniMax::openDatabase(const char *directory, unsigned int maximumNumberOfBranches)
{
@ -205,8 +205,8 @@ bool MiniMax::openDatabase(const char *directory, unsigned int maximumNumberOfBr
}
//-----------------------------------------------------------------------------
// Name: openSkvFile()
// Desc:
// openSkvFile()
//
//-----------------------------------------------------------------------------
void MiniMax::openSkvFile(const char *directory, unsigned int maximumNumberOfBranches)
{
@ -285,8 +285,8 @@ void MiniMax::openSkvFile(const char *directory, unsigned int maximumNumberOfBra
}
//-----------------------------------------------------------------------------
// Name: openPlyInfoFile()
// Desc:
// openPlyInfoFile()
//
//-----------------------------------------------------------------------------
void MiniMax::openPlyInfoFile(const char *directory)
{
@ -357,8 +357,8 @@ void MiniMax::openPlyInfoFile(const char *directory)
}
//-----------------------------------------------------------------------------
// Name: saveLayerToFile()
// Desc:
// saveLayerToFile()
//
//-----------------------------------------------------------------------------
void MiniMax::saveLayerToFile(unsigned int layerNumber)
{
@ -384,8 +384,8 @@ void MiniMax::saveLayerToFile(unsigned int layerNumber)
}
//-----------------------------------------------------------------------------
// Name: measureIops()
// Desc:
// measureIops()
//
//-----------------------------------------------------------------------------
inline void MiniMax::measureIops(long long &numOperations, LARGE_INTEGER &interval, LARGE_INTEGER &curTimeBefore, char text[])
{
@ -417,8 +417,8 @@ inline void MiniMax::measureIops(long long &numOperations, LARGE_INTEGER &interv
}
//-----------------------------------------------------------------------------
// Name: readKnotValueFromDatabase()
// Desc:
// readKnotValueFromDatabase()
//
//-----------------------------------------------------------------------------
void MiniMax::readKnotValueFromDatabase(unsigned int threadNo, unsigned int &layerNumber, unsigned int &stateNumber, TwoBit &knotValue, bool &invalidLayerOrStateNumber, bool &layerInDatabaseAndCompleted)
{
@ -446,8 +446,8 @@ void MiniMax::readKnotValueFromDatabase(unsigned int threadNo, unsigned int &lay
}
//-----------------------------------------------------------------------------
// Name: readKnotValueFromDatabase()
// Desc:
// readKnotValueFromDatabase()
//
//-----------------------------------------------------------------------------
void MiniMax::readKnotValueFromDatabase(unsigned int layerNumber, unsigned int stateNumber, TwoBit &knotValue)
{
@ -514,8 +514,8 @@ void MiniMax::readKnotValueFromDatabase(unsigned int layerNumber, unsigned int s
}
//-----------------------------------------------------------------------------
// Name: readPlyInfoFromDatabase()
// Desc:
// readPlyInfoFromDatabase()
//
//-----------------------------------------------------------------------------
void MiniMax::readPlyInfoFromDatabase(unsigned int layerNumber, unsigned int stateNumber, PlyInfoVarType &value)
{
@ -575,8 +575,8 @@ void MiniMax::readPlyInfoFromDatabase(unsigned int layerNumber, unsigned int sta
}
//-----------------------------------------------------------------------------
// Name: saveKnotValueInDatabase()
// Desc:
// saveKnotValueInDatabase()
//
//-----------------------------------------------------------------------------
void MiniMax::saveKnotValueInDatabase(unsigned int layerNumber, unsigned int stateNumber, TwoBit knotValue)
{
@ -637,8 +637,8 @@ void MiniMax::saveKnotValueInDatabase(unsigned int layerNumber, unsigned int sta
}
//-----------------------------------------------------------------------------
// Name: savePlyInfoInDatabase()
// Desc:
// savePlyInfoInDatabase()
//
//-----------------------------------------------------------------------------
void MiniMax::savePlyInfoInDatabase(unsigned int layerNumber, unsigned int stateNumber, PlyInfoVarType value)
{

View File

@ -9,8 +9,8 @@ s\*********************************************************************/
#include "miniMax.h"
//-----------------------------------------------------------------------------
// Name: calcKnotValuesByRetroAnalysis()
// Desc:
// calcKnotValuesByRetroAnalysis()
//
// The COUNT-ARRAY is the main element of the algorithmn. It contains the number of succeding states for the drawn gamestates,
// whose short knot value has to be determined. If all succeding states (branches representing possible moves) are for example won than,
// a state can be marked as lost, since no branch will lead to a drawn or won situation any more.
@ -115,8 +115,8 @@ freeMem:
}
//-----------------------------------------------------------------------------
// Name: initRetroAnalysis()
// Desc: The state values for all game situations in the database are marked as invalid, as undecided, as won or as lost by using the function getValueOfSituation().
// initRetroAnalysis()
// The state values for all game situations in the database are marked as invalid, as undecided, as won or as lost by using the function getValueOfSituation().
//-----------------------------------------------------------------------------
bool MiniMax::initRetroAnalysis(retroAnalysisGlobalVars &retroVars)
{
@ -199,8 +199,8 @@ bool MiniMax::initRetroAnalysis(retroAnalysisGlobalVars &retroVars)
}
//-----------------------------------------------------------------------------
// Name: initRetroAnalysisParallelSub()
// Desc:
// initRetroAnalysisParallelSub()
//
//-----------------------------------------------------------------------------
DWORD MiniMax::initRetroAnalysisThreadProc(void *pParameter, int index)
{
@ -269,8 +269,8 @@ DWORD MiniMax::initRetroAnalysisThreadProc(void *pParameter, int index)
}
//-----------------------------------------------------------------------------
// Name: prepareCountArrays()
// Desc:
// prepareCountArrays()
//
//-----------------------------------------------------------------------------
bool MiniMax::prepareCountArrays(retroAnalysisGlobalVars &retroVars)
{
@ -359,8 +359,8 @@ bool MiniMax::prepareCountArrays(retroAnalysisGlobalVars &retroVars)
}
//-----------------------------------------------------------------------------
// Name: calcNumSuccedors()
// Desc:
// calcNumSuccedors()
//
//-----------------------------------------------------------------------------
bool MiniMax::calcNumSuccedors(retroAnalysisGlobalVars &retroVars)
{
@ -457,8 +457,8 @@ bool MiniMax::calcNumSuccedors(retroAnalysisGlobalVars &retroVars)
}
//-----------------------------------------------------------------------------
// Name: addNumSuccedorsThreadProc()
// Desc:
// addNumSuccedorsThreadProc()
//
//-----------------------------------------------------------------------------
DWORD MiniMax::addNumSuccedorsThreadProc(void *pParameter, int index)
{
@ -497,7 +497,7 @@ DWORD MiniMax::addNumSuccedorsThreadProc(void *pParameter, int index)
return TM_RETURN_VALUE_TERMINATE_ALL_THREADS;
}
// get list with statenumbers of predecessors
// get list with state numbers of predecessors
m->getPredecessors(ansVars->curThreadNo, &amountOfPred, ansVars->predVars);
// iteration
@ -546,8 +546,8 @@ DWORD MiniMax::addNumSuccedorsThreadProc(void *pParameter, int index)
}
//-----------------------------------------------------------------------------
// Name: performRetroAnalysis()
// Desc:
// performRetroAnalysis()
//
//-----------------------------------------------------------------------------
bool MiniMax::performRetroAnalysis(retroAnalysisGlobalVars &retroVars)
{
@ -601,8 +601,8 @@ bool MiniMax::performRetroAnalysis(retroAnalysisGlobalVars &retroVars)
}
//-----------------------------------------------------------------------------
// Name: performRetroAnalysisThreadProc()
// Desc:
// performRetroAnalysisThreadProc()
//
//-----------------------------------------------------------------------------
DWORD MiniMax::performRetroAnalysisThreadProc(void *pParameter)
{
@ -640,7 +640,7 @@ DWORD MiniMax::performRetroAnalysisThreadProc(void *pParameter)
}
while (threadVars->statesToProcess[curNumPlies]->takeBytes(sizeof(StateAdress), (unsigned char *)&curState)) {
// execution cancelled by user?
// execution canceled by user?
if (m->threadManager.wasExecutionCancelled()) {
PRINT(0, m, "\n****************************************\nSub-thread no. " << threadNo << ": Execution cancelled by user!\n****************************************\n");
return TM_RETURN_VALUE_EXECUTION_CANCELLED;
@ -672,7 +672,7 @@ DWORD MiniMax::performRetroAnalysisThreadProc(void *pParameter)
return TM_RETURN_VALUE_TERMINATE_ALL_THREADS;
}
// get list with statenumbers of predecessors
// get list with state numbers of predecessors
m->getPredecessors(threadNo, &amountOfPred, predVars);
// iteration
@ -753,8 +753,8 @@ DWORD MiniMax::performRetroAnalysisThreadProc(void *pParameter)
}
//-----------------------------------------------------------------------------
// Name: addStateToProcessQueue()
// Desc:
// addStateToProcessQueue()
//
//-----------------------------------------------------------------------------
bool MiniMax::addStateToProcessQueue(retroAnalysisGlobalVars &retroVars, RetroAnalysisThreadVars &threadVars, unsigned int plyNumber, StateAdress *pState)
{

View File

@ -6,6 +6,8 @@
https://github.com/madweasel/Muehle
\*********************************************************************/
#include "miniMax.h"
struct RetroAnalysisQueueState
{
StateNumberVarType stateNumber; // state stored in the retro analysis queue. the queue is a buffer containing states to be passed to 'RetroAnalysisThreadVars::statesToProcess'

View File

@ -9,8 +9,8 @@
#include "miniMax.h"
//-----------------------------------------------------------------------------
// Name: showMemoryStatus()
// Desc:
// showMemoryStatus()
//
//-----------------------------------------------------------------------------
unsigned int MiniMax::getNumThreads()
{
@ -18,8 +18,8 @@ unsigned int MiniMax::getNumThreads()
}
//-----------------------------------------------------------------------------
// Name: anyFreshlyCalculatedLayer()
// Desc: called by MAIN-thread in pMiniMax->csOsPrint critical-section
// anyFreshlyCalculatedLayer()
// called by MAIN-thread in pMiniMax->csOsPrint critical-section
//-----------------------------------------------------------------------------
bool MiniMax::anyFreshlyCalculatedLayer()
{
@ -27,8 +27,8 @@ bool MiniMax::anyFreshlyCalculatedLayer()
}
//-----------------------------------------------------------------------------
// Name: getLastCalculatedLayer()
// Desc: called by MAIN-thread in pMiniMax->csOsPrint critical-section
// getLastCalculatedLayer()
// called by MAIN-thread in pMiniMax->csOsPrint critical-section
//-----------------------------------------------------------------------------
unsigned int MiniMax::getLastCalculatedLayer()
{
@ -38,8 +38,8 @@ unsigned int MiniMax::getLastCalculatedLayer()
}
//-----------------------------------------------------------------------------
// Name: isLayerInDatabase()
// Desc:
// isLayerInDatabase()
//
//-----------------------------------------------------------------------------
bool MiniMax::isLayerInDatabase(unsigned int layerNum)
{
@ -48,8 +48,8 @@ bool MiniMax::isLayerInDatabase(unsigned int layerNum)
}
//-----------------------------------------------------------------------------
// Name: getLayerSizeInBytes()
// Desc:
// getLayerSizeInBytes()
//
//-----------------------------------------------------------------------------
long long MiniMax::getLayerSizeInBytes(unsigned int layerNum)
{
@ -58,8 +58,8 @@ long long MiniMax::getLayerSizeInBytes(unsigned int layerNum)
}
//-----------------------------------------------------------------------------
// Name: getNumWonStates()
// Desc:
// getNumWonStates()
//
//-----------------------------------------------------------------------------
MiniMax::StateNumberVarType MiniMax::getNumWonStates(unsigned int layerNum)
{
@ -68,8 +68,8 @@ MiniMax::StateNumberVarType MiniMax::getNumWonStates(unsigned int layerNum)
}
//-----------------------------------------------------------------------------
// Name: getNumLostStates()
// Desc:
// getNumLostStates()
//
//-----------------------------------------------------------------------------
MiniMax::StateNumberVarType MiniMax::getNumLostStates(unsigned int layerNum)
{
@ -78,8 +78,8 @@ MiniMax::StateNumberVarType MiniMax::getNumLostStates(unsigned int layerNum)
}
//-----------------------------------------------------------------------------
// Name: getNumDrawnStates()
// Desc:
// getNumDrawnStates()
//
//-----------------------------------------------------------------------------
MiniMax::StateNumberVarType MiniMax::getNumDrawnStates(unsigned int layerNum)
{
@ -88,8 +88,8 @@ MiniMax::StateNumberVarType MiniMax::getNumDrawnStates(unsigned int layerNum)
}
//-----------------------------------------------------------------------------
// Name: getNumInvalidStates()
// Desc:
// getNumInvalidStates()
//
//-----------------------------------------------------------------------------
MiniMax::StateNumberVarType MiniMax::getNumInvalidStates(unsigned int layerNum)
{
@ -98,8 +98,8 @@ MiniMax::StateNumberVarType MiniMax::getNumInvalidStates(unsigned int layerNum)
}
//-----------------------------------------------------------------------------
// Name: showMemoryStatus()
// Desc:
// showMemoryStatus()
//
//-----------------------------------------------------------------------------
void MiniMax::showMemoryStatus()
{
@ -118,8 +118,8 @@ void MiniMax::showMemoryStatus()
}
//-----------------------------------------------------------------------------
// Name: setOutputStream()
// Desc:
// setOutputStream()
//
//-----------------------------------------------------------------------------
void MiniMax::setOutputStream(ostream *theStream, void(*printFunc)(void *pUserData), void *pUserData)
{
@ -129,8 +129,8 @@ void MiniMax::setOutputStream(ostream *theStream, void(*printFunc)(void *pUserDa
}
//-----------------------------------------------------------------------------
// Name: showLayerStats()
// Desc:
// showLayerStats()
//
//-----------------------------------------------------------------------------
void MiniMax::showLayerStats(unsigned int layerNumber)
{
@ -161,8 +161,8 @@ void MiniMax::showLayerStats(unsigned int layerNumber)
}
//-----------------------------------------------------------------------------
// Name: calcLayerStatistics()
// Desc:
// calcLayerStatistics()
//
//-----------------------------------------------------------------------------
bool MiniMax::calcLayerStatistics(char *statisticsFileName)
{
@ -255,8 +255,8 @@ bool MiniMax::calcLayerStatistics(char *statisticsFileName)
}
//-----------------------------------------------------------------------------
// Name: anyArrawInfoToUpdate()
// Desc: called by MAIN-thread in pMiniMax->csOsPrint critical-section
// anyArrawInfoToUpdate()
// called by MAIN-thread in pMiniMax->csOsPrint critical-section
//-----------------------------------------------------------------------------
bool MiniMax::anyArrawInfoToUpdate()
{
@ -264,8 +264,8 @@ bool MiniMax::anyArrawInfoToUpdate()
}
//-----------------------------------------------------------------------------
// Name: getArrayInfoForUpdate()
// Desc: called by MAIN-thread in pMiniMax->csOsPrint critical-section
// getArrayInfoForUpdate()
// called by MAIN-thread in pMiniMax->csOsPrint critical-section
//-----------------------------------------------------------------------------
MiniMax::ArrayInfoChange MiniMax::getArrayInfoForUpdate()
{
@ -275,8 +275,8 @@ MiniMax::ArrayInfoChange MiniMax::getArrayInfoForUpdate()
}
//-----------------------------------------------------------------------------
// Name: getCurrentActionStr()
// Desc: called by MAIN-thread in pMiniMax->csOsPrint critical-section
// getCurrentActionStr()
// called by MAIN-thread in pMiniMax->csOsPrint critical-section
//-----------------------------------------------------------------------------
LPWSTR MiniMax::getCurrentActionStr()
{
@ -294,8 +294,8 @@ LPWSTR MiniMax::getCurrentActionStr()
}
//-----------------------------------------------------------------------------
// Name: getCurrentCalculatedLayer()
// Desc: called by MAIN-thread in pMiniMax->csOsPrint critical-section
// getCurrentCalculatedLayer()
// called by MAIN-thread in pMiniMax->csOsPrint critical-section
//-----------------------------------------------------------------------------
void MiniMax::getCurrentCalculatedLayer(vector<unsigned int> &layers)
{
@ -311,8 +311,8 @@ void MiniMax::getCurrentCalculatedLayer(vector<unsigned int> &layers)
}
//-----------------------------------------------------------------------------
// Name: ArrayInfoContainer::addArray()
// Desc: Caution: layerNumber and type must be a unique pair!
// ArrayInfoContainer::addArray()
// Caution: layerNumber and type must be a unique pair!
// called by single CALCULATION-thread
//-----------------------------------------------------------------------------
void MiniMax::ArrayInfoContainer::addArray(unsigned int layerNumber, unsigned int type, long long size, long long compressedSize)
@ -346,8 +346,8 @@ void MiniMax::ArrayInfoContainer::addArray(unsigned int layerNumber, unsigned in
}
//-----------------------------------------------------------------------------
// Name: ArrayInfoContainer::removeArray()
// Desc: called by single CALCULATION-thread
// ArrayInfoContainer::removeArray()
// called by single CALCULATION-thread
//-----------------------------------------------------------------------------
void MiniMax::ArrayInfoContainer::removeArray(unsigned int layerNumber, unsigned int type, long long size, long long compressedSize)
{
@ -383,8 +383,8 @@ void MiniMax::ArrayInfoContainer::removeArray(unsigned int layerNumber, unsigned
}
//-----------------------------------------------------------------------------
// Name: ArrayInfoContainer::updateArray()
// Desc: called by mltiple CALCULATION-thread
// ArrayInfoContainer::updateArray()
// called by mltiple CALCULATION-thread
//-----------------------------------------------------------------------------
void MiniMax::ArrayInfoContainer::updateArray(unsigned int layerNumber, unsigned int type)
{

View File

@ -9,8 +9,8 @@
#include "miniMax.h"
//-----------------------------------------------------------------------------
// Name: testLayer()
// Desc:
// testLayer()
//
//-----------------------------------------------------------------------------
bool MiniMax::testLayer(unsigned int layerNumber)
{
@ -84,8 +84,8 @@ bool MiniMax::testLayer(unsigned int layerNumber)
}
//-----------------------------------------------------------------------------
// Name: testLayerThreadProc()
// Desc:
// testLayerThreadProc()
//
//-----------------------------------------------------------------------------
DWORD MiniMax::testLayerThreadProc(void *pParameter, int index)
{
@ -312,8 +312,8 @@ errorInDatabase:
}
//-----------------------------------------------------------------------------
// Name: testState()
// Desc:
// testState()
//
//-----------------------------------------------------------------------------
bool MiniMax::testState(unsigned int layerNumber, unsigned int stateNumber)
{
@ -341,8 +341,8 @@ bool MiniMax::testState(unsigned int layerNumber, unsigned int stateNumber)
}
//-----------------------------------------------------------------------------
// Name: testSetSituationAndGetPoss()
// Desc:
// testSetSituationAndGetPoss()
//
//-----------------------------------------------------------------------------
bool MiniMax::testSetSituationAndGetPoss(unsigned int layerNumber)
{
@ -408,8 +408,8 @@ bool MiniMax::testSetSituationAndGetPoss(unsigned int layerNumber)
}
//-----------------------------------------------------------------------------
// Name: testSetSituationThreadProc()
// Desc:
// testSetSituationThreadProc()
//
//-----------------------------------------------------------------------------
DWORD MiniMax::testSetSituationThreadProc(void *pParameter, int index)
{
@ -491,8 +491,8 @@ DWORD MiniMax::testSetSituationThreadProc(void *pParameter, int index)
}
//-----------------------------------------------------------------------------
// Name: testIfSymStatesHaveSameValue()
// Desc:
// testIfSymStatesHaveSameValue()
//
//-----------------------------------------------------------------------------
bool MiniMax::testIfSymStatesHaveSameValue(unsigned int layerNumber)
{

View File

@ -184,8 +184,8 @@ unsigned int fieldPosIsOfGroup[] = { GROUP_C, GROUP_D, GROUP_C,
GROUP_C, GROUP_D, GROUP_C };
//-----------------------------------------------------------------------------
// Name: PerfectAI()
// Desc: PerfectAI class constructor
// PerfectAI()
// PerfectAI class constructor
//-----------------------------------------------------------------------------
PerfectAI::PerfectAI(const char *directory)
{
@ -653,8 +653,8 @@ PerfectAI::PerfectAI(const char *directory)
}
//-----------------------------------------------------------------------------
// Name: ~PerfectAI()
// Desc: PerfectAI class destructor
// ~PerfectAI()
// PerfectAI class destructor
//-----------------------------------------------------------------------------
PerfectAI::~PerfectAI()
{
@ -672,8 +672,8 @@ PerfectAI::~PerfectAI()
}
//-----------------------------------------------------------------------------
// Name: play()
// Desc:
// play()
//
//-----------------------------------------------------------------------------
void PerfectAI::play(fieldStruct *theField, unsigned int *pushFrom, unsigned int *pushTo)
{
@ -731,8 +731,8 @@ void PerfectAI::play(fieldStruct *theField, unsigned int *pushFrom, unsigned int
}
//-----------------------------------------------------------------------------
// Name: prepareDatabaseCalculation()
// Desc:
// prepareDatabaseCalculation()
//
//-----------------------------------------------------------------------------
void PerfectAI::prepareDatabaseCalculation()
{
@ -751,8 +751,8 @@ void PerfectAI::prepareDatabaseCalculation()
}
//-----------------------------------------------------------------------------
// Name: wrapUpDatabaseCalculation()
// Desc:
// wrapUpDatabaseCalculation()
//
//-----------------------------------------------------------------------------
void PerfectAI::wrapUpDatabaseCalculation(bool calculationAborted)
{
@ -768,8 +768,8 @@ void PerfectAI::wrapUpDatabaseCalculation(bool calculationAborted)
}
//-----------------------------------------------------------------------------
// Name: testLayers()
// Desc:
// testLayers()
//
//-----------------------------------------------------------------------------
bool PerfectAI::testLayers(unsigned int startTestFromLayer, unsigned int endTestAtLayer)
{
@ -793,8 +793,8 @@ bool PerfectAI::testLayers(unsigned int startTestFromLayer, unsigned int endTest
}
//-----------------------------------------------------------------------------
// Name: setDatabasePath()
// Desc:
// setDatabasePath()
//
//-----------------------------------------------------------------------------
bool PerfectAI::setDatabasePath(const char *directory)
{
@ -808,8 +808,8 @@ bool PerfectAI::setDatabasePath(const char *directory)
}
//-----------------------------------------------------------------------------
// Name: prepareBestChoiceCalculation()
// Desc:
// prepareBestChoiceCalculation()
//
//-----------------------------------------------------------------------------
void PerfectAI::prepareBestChoiceCalculation()
{
@ -822,8 +822,8 @@ void PerfectAI::prepareBestChoiceCalculation()
}
//-----------------------------------------------------------------------------
// Name: ThreadVars()
// Desc:
// ThreadVars()
//
//-----------------------------------------------------------------------------
PerfectAI::ThreadVars::ThreadVars()
{
@ -841,8 +841,8 @@ PerfectAI::ThreadVars::ThreadVars()
}
//-----------------------------------------------------------------------------
// Name: getPossSettingPhase()
// Desc:
// getPossSettingPhase()
//
//-----------------------------------------------------------------------------
unsigned int *PerfectAI::ThreadVars::getPossSettingPhase(unsigned int *numPossibilities, void **pPossibilities)
{
@ -890,8 +890,8 @@ unsigned int *PerfectAI::ThreadVars::getPossSettingPhase(unsigned int *numPossib
}
//-----------------------------------------------------------------------------
// Name: getPossNormalMove()
// Desc:
// getPossNormalMove()
//
//-----------------------------------------------------------------------------
unsigned int *PerfectAI::ThreadVars::getPossNormalMove(unsigned int *numPossibilities, void **pPossibilities)
{
@ -950,8 +950,8 @@ unsigned int *PerfectAI::ThreadVars::getPossNormalMove(unsigned int *numPossibil
}
//-----------------------------------------------------------------------------
// Name: getPossStoneRemove()
// Desc:
// getPossStoneRemove()
//
//-----------------------------------------------------------------------------
unsigned int *PerfectAI::ThreadVars::getPossStoneRemove(unsigned int *numPossibilities, void **pPossibilities)
{
@ -978,8 +978,8 @@ unsigned int *PerfectAI::ThreadVars::getPossStoneRemove(unsigned int *numPossibi
}
//-----------------------------------------------------------------------------
// Name: getPossibilities()
// Desc:
// getPossibilities()
//
//-----------------------------------------------------------------------------
unsigned int *PerfectAI::getPossibilities(unsigned int threadNo, unsigned int *numPossibilities, bool *opponentsMove, void **pPossibilities)
{
@ -1021,8 +1021,8 @@ unsigned int *PerfectAI::getPossibilities(unsigned int threadNo, unsigned int *n
}
//-----------------------------------------------------------------------------
// Name: getValueOfSituation()
// Desc:
// getValueOfSituation()
//
//-----------------------------------------------------------------------------
void PerfectAI::getValueOfSituation(unsigned int threadNo, float &floatValue, TwoBit &shortValue)
{
@ -1032,16 +1032,16 @@ void PerfectAI::getValueOfSituation(unsigned int threadNo, float &floatValue, Tw
}
//-----------------------------------------------------------------------------
// Name: deletePossibilities()
// Desc:
// deletePossibilities()
//
//-----------------------------------------------------------------------------
void PerfectAI::deletePossibilities(unsigned int threadNo, void *pPossibilities)
{
}
//-----------------------------------------------------------------------------
// Name: undo()
// Desc:
// undo()
//
//-----------------------------------------------------------------------------
void PerfectAI::undo(unsigned int threadNo, unsigned int idPossibility, bool opponentsMove, void *pBackup, void *pPossibilities)
{
@ -1076,8 +1076,8 @@ void PerfectAI::undo(unsigned int threadNo, unsigned int idPossibility, bool opp
}
//-----------------------------------------------------------------------------
// Name: setWarning()
// Desc:
// setWarning()
//
//-----------------------------------------------------------------------------
inline void PerfectAI::ThreadVars::setWarning(unsigned int stoneOne, unsigned int stoneTwo, unsigned int stoneThree)
{
@ -1098,8 +1098,8 @@ inline void PerfectAI::ThreadVars::setWarning(unsigned int stoneOne, unsigned in
}
//-----------------------------------------------------------------------------
// Name: updateWarning()
// Desc:
// updateWarning()
//
//-----------------------------------------------------------------------------
inline void PerfectAI::ThreadVars::updateWarning(unsigned int firstStone, unsigned int secondStone)
{
@ -1128,8 +1128,8 @@ inline void PerfectAI::ThreadVars::updateWarning(unsigned int firstStone, unsign
}
//-----------------------------------------------------------------------------
// Name: updatePossibleMoves()
// Desc:
// updatePossibleMoves()
//
//-----------------------------------------------------------------------------
inline void PerfectAI::ThreadVars::updatePossibleMoves(unsigned int stone, Player *stoneOwner, bool stoneRemoved, unsigned int ignoreStone)
{
@ -1181,8 +1181,8 @@ inline void PerfectAI::ThreadVars::updatePossibleMoves(unsigned int stone, Playe
}
//-----------------------------------------------------------------------------
// Name: setStone()
// Desc:
// setStone()
//
//-----------------------------------------------------------------------------
inline void PerfectAI::ThreadVars::setStone(unsigned int to, Backup *backup)
{
@ -1209,8 +1209,8 @@ inline void PerfectAI::ThreadVars::setStone(unsigned int to, Backup *backup)
}
//-----------------------------------------------------------------------------
// Name: normalMove()
// Desc:
// normalMove()
//
//-----------------------------------------------------------------------------
inline void PerfectAI::ThreadVars::normalMove(unsigned int from, unsigned int to, Backup *backup)
{
@ -1233,8 +1233,8 @@ inline void PerfectAI::ThreadVars::normalMove(unsigned int from, unsigned int to
}
//-----------------------------------------------------------------------------
// Name: removeStone()
// Desc:
// removeStone()
//
//-----------------------------------------------------------------------------
inline void PerfectAI::ThreadVars::removeStone(unsigned int from, Backup *backup)
{
@ -1262,8 +1262,8 @@ inline void PerfectAI::ThreadVars::removeStone(unsigned int from, Backup *backup
}
//-----------------------------------------------------------------------------
// Name: move()
// Desc:
// move()
//
//-----------------------------------------------------------------------------
void PerfectAI::move(unsigned int threadNo, unsigned int idPossibility, bool opponentsMove, void **pBackup, void *pPossibilities)
{
@ -1339,8 +1339,8 @@ void PerfectAI::move(unsigned int threadNo, unsigned int idPossibility, bool opp
}
//-----------------------------------------------------------------------------
// Name: storeValueOfMove()
// Desc:
// storeValueOfMove()
//
//-----------------------------------------------------------------------------
void PerfectAI::storeValueOfMove(unsigned int threadNo, unsigned int idPossibility, void *pPossibilities, unsigned char value, unsigned int *freqValuesSubMoves, PlyInfoVarType plyInfo)
{
@ -1365,8 +1365,8 @@ void PerfectAI::storeValueOfMove(unsigned int threadNo, unsigned int idPossibili
}
//-----------------------------------------------------------------------------
// Name: getValueOfMoves()
// Desc:
// getValueOfMoves()
//
//-----------------------------------------------------------------------------
void PerfectAI::getValueOfMoves(unsigned char *moveValue, unsigned int *freqValuesSubMoves, PlyInfoVarType *plyInfo, unsigned int *moveQuality, unsigned char &knotValue, PlyInfoVarType &bestAmountOfPlies)
{
@ -1450,8 +1450,8 @@ void PerfectAI::getValueOfMoves(unsigned char *moveValue, unsigned int *freqValu
}
//-----------------------------------------------------------------------------
// Name: printMoveInformation()
// Desc:
// printMoveInformation()
//
//-----------------------------------------------------------------------------
void PerfectAI::printMoveInformation(unsigned int threadNo, unsigned int idPossibility, void *pPossibilities)
{
@ -1469,8 +1469,8 @@ void PerfectAI::printMoveInformation(unsigned int threadNo, unsigned int idPossi
}
//-----------------------------------------------------------------------------
// Name: getNumberOfLayers()
// Desc: called one time
// getNumberOfLayers()
// called one time
//-----------------------------------------------------------------------------
unsigned int PerfectAI::getNumberOfLayers()
{
@ -1478,8 +1478,8 @@ unsigned int PerfectAI::getNumberOfLayers()
}
//-----------------------------------------------------------------------------
// Name: shallRetroAnalysisBeUsed()
// Desc: called one time for each layer time
// shallRetroAnalysisBeUsed()
// called one time for each layer time
//-----------------------------------------------------------------------------
bool PerfectAI::shallRetroAnalysisBeUsed(unsigned int layerNum)
{
@ -1490,8 +1490,8 @@ bool PerfectAI::shallRetroAnalysisBeUsed(unsigned int layerNum)
}
//-----------------------------------------------------------------------------
// Name: getNumberOfKnotsInLayer()
// Desc: called one time
// getNumberOfKnotsInLayer()
// called one time
//-----------------------------------------------------------------------------
unsigned int PerfectAI::getNumberOfKnotsInLayer(unsigned int layerNum)
{
@ -1511,8 +1511,8 @@ unsigned int PerfectAI::getNumberOfKnotsInLayer(unsigned int layerNum)
}
//-----------------------------------------------------------------------------
// Name: nOverN()
// Desc: called seldom
// nOverN()
// called seldom
//-----------------------------------------------------------------------------
long long PerfectAI::mOverN_Function(unsigned int m, unsigned int n)
{
@ -1544,8 +1544,8 @@ long long PerfectAI::mOverN_Function(unsigned int m, unsigned int n)
}
//-----------------------------------------------------------------------------
// Name: applySymmetrieOperationOnField()
// Desc: called very often
// applySymmetrieOperationOnField()
// called very often
//-----------------------------------------------------------------------------
void PerfectAI::applySymmetrieOperationOnField(unsigned char symmetryOperationNumber, unsigned int *sourceField, unsigned int *destField)
{
@ -1555,8 +1555,8 @@ void PerfectAI::applySymmetrieOperationOnField(unsigned char symmetryOperationNu
}
//-----------------------------------------------------------------------------
// Name: getLayerNumber()
// Desc:
// getLayerNumber()
//
//-----------------------------------------------------------------------------
unsigned int PerfectAI::getLayerNumber(unsigned int threadNo)
{
@ -1568,8 +1568,8 @@ unsigned int PerfectAI::getLayerNumber(unsigned int threadNo)
}
//-----------------------------------------------------------------------------
// Name: getLayerAndStateNumber()
// Desc:
// getLayerAndStateNumber()
//
//-----------------------------------------------------------------------------
unsigned int PerfectAI::getLayerAndStateNumber(unsigned int threadNo, unsigned int &layerNum, unsigned int &stateNumber)
{
@ -1578,8 +1578,8 @@ unsigned int PerfectAI::getLayerAndStateNumber(unsigned int threadNo, unsigned i
}
//-----------------------------------------------------------------------------
// Name: getLayerAndStateNumber()
// Desc: Current player has white stones, the opponent the black ones.
// getLayerAndStateNumber()
// Current player has white stones, the opponent the black ones.
//-----------------------------------------------------------------------------
unsigned int PerfectAI::ThreadVars::getLayerAndStateNumber(unsigned int &layerNum, unsigned int &stateNumber)
{
@ -1631,8 +1631,8 @@ unsigned int PerfectAI::ThreadVars::getLayerAndStateNumber(unsigned int &layerNu
}
//-----------------------------------------------------------------------------
// Name: setSituation()
// Desc: Current player has white stones, the opponent the black ones.
// setSituation()
// Current player has white stones, the opponent the black ones.
// Sets up the game situation corresponding to the passed layer number and state.
//-----------------------------------------------------------------------------
bool PerfectAI::setSituation(unsigned int threadNo, unsigned int layerNum, unsigned int stateNumber)
@ -1801,8 +1801,8 @@ bool PerfectAI::setSituation(unsigned int threadNo, unsigned int layerNum, unsig
}
//-----------------------------------------------------------------------------
// Name: calcPossibleMoves()
// Desc:
// calcPossibleMoves()
//
//-----------------------------------------------------------------------------
void PerfectAI::ThreadVars::calcPossibleMoves(Player *player)
{
@ -1840,8 +1840,8 @@ void PerfectAI::ThreadVars::calcPossibleMoves(Player *player)
}
//-----------------------------------------------------------------------------
// Name: setWarningAndMill()
// Desc:
// setWarningAndMill()
//
//-----------------------------------------------------------------------------
void PerfectAI::ThreadVars::setWarningAndMill(unsigned int stone, unsigned int firstNeighbour, unsigned int secondNeighbour)
{
@ -1858,8 +1858,8 @@ void PerfectAI::ThreadVars::setWarningAndMill(unsigned int stone, unsigned int f
}
//-----------------------------------------------------------------------------
// Name: getOutputInformation()
// Desc:
// getOutputInformation()
//
//-----------------------------------------------------------------------------
string PerfectAI::getOutputInformation(unsigned int layerNum)
{
@ -1869,8 +1869,8 @@ string PerfectAI::getOutputInformation(unsigned int layerNum)
}
//-----------------------------------------------------------------------------
// Name: printBoard()
// Desc:
// printBoard()
//
//-----------------------------------------------------------------------------
void PerfectAI::printBoard(unsigned int threadNo, unsigned char value)
{
@ -1887,8 +1887,8 @@ void PerfectAI::printBoard(unsigned int threadNo, unsigned char value)
}
//-----------------------------------------------------------------------------
// Name: getField()
// Desc:
// getField()
//
//-----------------------------------------------------------------------------
void PerfectAI::getField(unsigned int layerNum, unsigned int stateNumber, fieldStruct *field, bool *gameHasFinished)
{
@ -1902,8 +1902,8 @@ void PerfectAI::getField(unsigned int layerNum, unsigned int stateNumber, fieldS
}
//-----------------------------------------------------------------------------
// Name: getLayerAndStateNumber()
// Desc:
// getLayerAndStateNumber()
//
//-----------------------------------------------------------------------------
void PerfectAI::getLayerAndStateNumber(unsigned int &layerNum, unsigned int &stateNumber /*, unsigned int& symmetryOperation*/)
{
@ -1911,8 +1911,8 @@ void PerfectAI::getLayerAndStateNumber(unsigned int &layerNum, unsigned int &sta
}
//-----------------------------------------------------------------------------
// Name: setOpponentLevel()
// Desc:
// setOpponentLevel()
//
//-----------------------------------------------------------------------------
void PerfectAI::setOpponentLevel(unsigned int threadNo, bool isOpponentLevel)
{
@ -1921,8 +1921,8 @@ void PerfectAI::setOpponentLevel(unsigned int threadNo, bool isOpponentLevel)
}
//-----------------------------------------------------------------------------
// Name: getOpponentLevel()
// Desc:
// getOpponentLevel()
//
//-----------------------------------------------------------------------------
bool PerfectAI::getOpponentLevel(unsigned int threadNo)
{
@ -1931,8 +1931,8 @@ bool PerfectAI::getOpponentLevel(unsigned int threadNo)
}
//-----------------------------------------------------------------------------
// Name: getPartnerLayer()
// Desc:
// getPartnerLayer()
//
//-----------------------------------------------------------------------------
unsigned int PerfectAI::getPartnerLayer(unsigned int layerNum)
{
@ -1946,8 +1946,8 @@ unsigned int PerfectAI::getPartnerLayer(unsigned int layerNum)
}
//-----------------------------------------------------------------------------
// Name: getSuccLayers()
// Desc:
// getSuccLayers()
//
//-----------------------------------------------------------------------------
void PerfectAI::getSuccLayers(unsigned int layerNum, unsigned int *amountOfSuccLayers, unsigned int *succLayers)
{
@ -1976,8 +1976,8 @@ void PerfectAI::getSuccLayers(unsigned int layerNum, unsigned int *amountOfSuccL
}
//-----------------------------------------------------------------------------
// Name: getSymStateNumWithDoubles()
// Desc:
// getSymStateNumWithDoubles()
//
//-----------------------------------------------------------------------------
void PerfectAI::getSymStateNumWithDoubles(unsigned int threadNo, unsigned int *numSymmetricStates, unsigned int **symStateNumbers)
{
@ -2017,8 +2017,8 @@ void PerfectAI::getSymStateNumWithDoubles(unsigned int threadNo, unsigned int *n
}
//-----------------------------------------------------------------------------
// Name: fieldIntegrityOK()
// Desc:
// fieldIntegrityOK()
//
//-----------------------------------------------------------------------------
bool PerfectAI::ThreadVars::fieldIntegrityOK(unsigned int numberOfMillsCurrentPlayer, unsigned int numberOfMillsOpponentPlayer, bool aStoneCanBeRemovedFromCurPlayer)
{
@ -2067,8 +2067,8 @@ bool PerfectAI::ThreadVars::fieldIntegrityOK(unsigned int numberOfMillsCurrentPl
}
//-----------------------------------------------------------------------------
// Name: isSymOperationInvariantOnGroupCD()
// Desc:
// isSymOperationInvariantOnGroupCD()
//
//-----------------------------------------------------------------------------
bool PerfectAI::isSymOperationInvariantOnGroupCD(unsigned int symmetryOperation, int *theField)
{
@ -2128,8 +2128,8 @@ bool PerfectAI::isSymOperationInvariantOnGroupCD(unsigned int symmetryOperation,
}
//-----------------------------------------------------------------------------
// Name: storePredecessor()
// Desc:
// storePredecessor()
//
//-----------------------------------------------------------------------------
void PerfectAI::ThreadVars::storePredecessor(unsigned int numberOfMillsCurrentPlayer, unsigned int numberOfMillsOpponentPlayer, unsigned int *amountOfPred, RetroAnalysisPredVars *predVars)
{
@ -2177,8 +2177,8 @@ void PerfectAI::ThreadVars::storePredecessor(unsigned int numberOfMillsCurrentPl
}
//-----------------------------------------------------------------------------
// Name: getPredecessors()
// Desc: CAUTION: States musn't be returned twice.
// getPredecessors()
// CAUTION: States musn't be returned twice.
//-----------------------------------------------------------------------------
void PerfectAI::getPredecessors(unsigned int threadNo, unsigned int *amountOfPred, RetroAnalysisPredVars *predVars)
{
@ -2421,8 +2421,8 @@ void PerfectAI::getPredecessors(unsigned int threadNo, unsigned int *amountOfPre
}
//-----------------------------------------------------------------------------
// Name: checkMoveAndSetSituation()
// Desc:
// checkMoveAndSetSituation()
//
//-----------------------------------------------------------------------------
bool PerfectAI::checkMoveAndSetSituation()
{
@ -2512,8 +2512,8 @@ bool PerfectAI::checkMoveAndSetSituation()
}
//-----------------------------------------------------------------------------
// Name: checkGetPossThanGetPred()
// Desc:
// checkGetPossThanGetPred()
//
//-----------------------------------------------------------------------------
bool PerfectAI::checkGetPossThanGetPred()
{
@ -2601,8 +2601,8 @@ bool PerfectAI::checkGetPossThanGetPred()
}
//-----------------------------------------------------------------------------
// Name: checkGetPredThanGetPoss()
// Desc:
// checkGetPredThanGetPoss()
//
//-----------------------------------------------------------------------------
bool PerfectAI::checkGetPredThanGetPoss()
{
@ -2797,7 +2797,7 @@ bool PerfectAI::checkGetPredThanGetPoss()
}
/*** To Do's ***************************************
- Wom<EFBFBD>glich alle cyclicArrays in einer Datei speichern. Besser sogar noch kompromieren (auf Windows oder Programm-Ebene?), was gut gehen sollte da ja eh blockweise gearbeitet wird.
Da Gr<EFBFBD><EFBFBD>e vorher unbekannt muss eine table her. M<EFBFBD>glicher Klassenname "compressedCyclicArray(blockSize, numBlocks, numArrays, filePath)".
- initFileReader implementieren
- Possibly save all cyclicArrays in a file. Better to even compress it (at Windows or program level?), Which should work fine because you work in blocks anyway.
Since the size was previously unknown, a table must be produced. Possible class name "compressedCyclicArray (blockSize, numBlocks, numArrays, filePath)".
- Implement initFileReader
***************************************************/

View File

@ -74,7 +74,7 @@
#define SO_INV_MIR_DIAG_2 15
#define NUM_SYM_OPERATIONS 16
/*** Klassen *********************************************************/
class PerfectAI : public MillAI, public MiniMax
{
protected:

View File

@ -9,8 +9,8 @@
#include "randomAI.h"
//-----------------------------------------------------------------------------
// Name: RandomAI()
// Desc: RandomAI class constructor
// RandomAI()
// RandomAI class constructor
//-----------------------------------------------------------------------------
RandomAI::RandomAI()
{
@ -19,8 +19,8 @@ RandomAI::RandomAI()
}
//-----------------------------------------------------------------------------
// Name: ~RandomAI()
// Desc: RandomAI class destructor
// ~RandomAI()
// RandomAI class destructor
//-----------------------------------------------------------------------------
RandomAI::~RandomAI()
{
@ -28,8 +28,8 @@ RandomAI::~RandomAI()
}
//-----------------------------------------------------------------------------
// Name: play()
// Desc:
// play()
//
//-----------------------------------------------------------------------------
void RandomAI::play(fieldStruct *theField, unsigned int *pushFrom, unsigned int *pushTo)
{

View File

@ -13,7 +13,7 @@
#include <time.h>
#include "millAI.h"
/*** Klassen *********************************************************/
class RandomAI : public MillAI
{

View File

@ -9,8 +9,8 @@
#include "strLib.h"
//-----------------------------------------------------------------------------
// Name: hibit()
// Desc:
// hibit()
//
//-----------------------------------------------------------------------------
int MyString::hibit(unsigned int n)
{
@ -23,16 +23,16 @@ int MyString::hibit(unsigned int n)
}
//-----------------------------------------------------------------------------
// Name: MyString()
// Desc:
// MyString()
//
//-----------------------------------------------------------------------------
MyString::MyString()
{
}
//-----------------------------------------------------------------------------
// Name: MyString()
// Desc:
// MyString()
//
//-----------------------------------------------------------------------------
MyString::MyString(const char *cStr)
{
@ -40,8 +40,8 @@ MyString::MyString(const char *cStr)
}
//-----------------------------------------------------------------------------
// Name: MyString()
// Desc:
// MyString()
//
//-----------------------------------------------------------------------------
MyString::MyString(const WCHAR *cStr)
{
@ -49,8 +49,8 @@ MyString::MyString(const WCHAR *cStr)
}
//-----------------------------------------------------------------------------
// Name: MyString()
// Desc:
// MyString()
//
//-----------------------------------------------------------------------------
MyString::~MyString()
{
@ -71,8 +71,8 @@ MyString::~MyString()
}
//-----------------------------------------------------------------------------
// Name: c_strA()
// Desc:
// c_strA()
//
//-----------------------------------------------------------------------------
const char *MyString::c_strA()
{
@ -80,8 +80,8 @@ const char *MyString::c_strA()
}
//-----------------------------------------------------------------------------
// Name: c_strW()
// Desc:
// c_strW()
//
//-----------------------------------------------------------------------------
const WCHAR *MyString::c_strW()
{
@ -89,8 +89,8 @@ const WCHAR *MyString::c_strW()
}
//-----------------------------------------------------------------------------
// Name: assign()
// Desc:
// assign()
//
//-----------------------------------------------------------------------------
MyString &MyString::assign(const char *cStr)
{
@ -118,8 +118,8 @@ MyString &MyString::assign(const char *cStr)
}
//-----------------------------------------------------------------------------
// Name: assign()
// Desc:
// assign()
//
//-----------------------------------------------------------------------------
MyString &MyString::assign(const WCHAR *cStr)
{
@ -147,8 +147,8 @@ MyString &MyString::assign(const WCHAR *cStr)
}
//-----------------------------------------------------------------------------
// Name: readAsciiData()
// Desc: This functions reads in a table of floating point values faster than "cin".
// readAsciiData()
// This functions reads in a table of floating point values faster than "cin".
//-----------------------------------------------------------------------------
bool readAsciiData(HANDLE hFile, double *pData, unsigned int numValues, unsigned char decimalSeperator, unsigned char columnSeparator)
{

View File

@ -9,8 +9,8 @@
#include "threadManager.h"
//-----------------------------------------------------------------------------
// Name: ThreadManager()
// Desc: ThreadManager class constructor
// ThreadManager()
// ThreadManager class constructor
//-----------------------------------------------------------------------------
ThreadManager::ThreadManager()
{
@ -40,8 +40,8 @@ ThreadManager::ThreadManager()
}
//-----------------------------------------------------------------------------
// Name: ~ThreadManager()
// Desc: ThreadManager class destructor
// ~ThreadManager()
// ThreadManager class destructor
//-----------------------------------------------------------------------------
ThreadManager::~ThreadManager()
{
@ -69,8 +69,8 @@ ThreadManager::~ThreadManager()
}
//-----------------------------------------------------------------------------
// Name: waitForOtherThreads()
// Desc:
// waitForOtherThreads()
//
//-----------------------------------------------------------------------------
void ThreadManager::waitForOtherThreads(unsigned int threadNo)
{
@ -113,8 +113,8 @@ void ThreadManager::waitForOtherThreads(unsigned int threadNo)
}
//-----------------------------------------------------------------------------
// Name: getNumThreads()
// Desc:
// getNumThreads()
//
//-----------------------------------------------------------------------------
unsigned int ThreadManager::getNumThreads()
{
@ -122,8 +122,8 @@ unsigned int ThreadManager::getNumThreads()
}
//-----------------------------------------------------------------------------
// Name: setNumThreads()
// Desc:
// setNumThreads()
//
//-----------------------------------------------------------------------------
bool ThreadManager::setNumThreads(unsigned int newNumThreads)
{
@ -151,8 +151,8 @@ bool ThreadManager::setNumThreads(unsigned int newNumThreads)
}
//-----------------------------------------------------------------------------
// Name: pauseExecution()
// Desc:
// pauseExecution()
//
//-----------------------------------------------------------------------------
void ThreadManager::pauseExecution()
{
@ -170,8 +170,8 @@ void ThreadManager::pauseExecution()
}
//-----------------------------------------------------------------------------
// Name: cancelExecution()
// Desc: Stops executeParallelLoop() before the next iteration.
// cancelExecution()
// Stops executeParallelLoop() before the next iteration.
// When executeInParallel() was called, user has to handle cancellation by himself.
//-----------------------------------------------------------------------------
void ThreadManager::cancelExecution()
@ -185,8 +185,8 @@ void ThreadManager::cancelExecution()
}
//-----------------------------------------------------------------------------
// Name: uncancelExecution()
// Desc:
// uncancelExecution()
//
//-----------------------------------------------------------------------------
void ThreadManager::uncancelExecution()
{
@ -194,8 +194,8 @@ void ThreadManager::uncancelExecution()
}
//-----------------------------------------------------------------------------
// Name: wasExecutionCancelled()
// Desc:
// wasExecutionCancelled()
//
//-----------------------------------------------------------------------------
bool ThreadManager::wasExecutionCancelled()
{
@ -203,8 +203,8 @@ bool ThreadManager::wasExecutionCancelled()
}
//-----------------------------------------------------------------------------
// Name: getThreadId()
// Desc: Returns a number from 0 to 'numThreads'-1. Returns 0 if the function fails.
// getThreadId()
// Returns a number from 0 to 'numThreads'-1. Returns 0 if the function fails.
//-----------------------------------------------------------------------------
unsigned int ThreadManager::getThreadNumber()
{
@ -222,8 +222,8 @@ unsigned int ThreadManager::getThreadNumber()
}
//-----------------------------------------------------------------------------
// Name: executeInParallel()
// Desc: lpParameter is an array of size numThreads.
// executeInParallel()
// lpParameter is an array of size numThreads.
//-----------------------------------------------------------------------------
unsigned int ThreadManager::executeInParallel(DWORD threadProc(void *pParameter), void *pParameter, unsigned int parameterStructSize)
{
@ -278,8 +278,8 @@ unsigned int ThreadManager::executeInParallel(DWORD threadProc(void *pParameter)
}
//-----------------------------------------------------------------------------
// Name: executeInParallel()
// Desc:
// executeInParallel()
//
// lpParameter - an array of size numThreads
// finalValue - this value is part of the iteration, meaning that index ranges from initialValue to finalValue including both border values
//-----------------------------------------------------------------------------
@ -390,8 +390,8 @@ unsigned int ThreadManager::executeParallelLoop(DWORD threadProc(void *pParamete
}
//-----------------------------------------------------------------------------
// Name: threadForLoop()
// Desc:
// threadForLoop()
//
//-----------------------------------------------------------------------------
DWORD WINAPI ThreadManager::threadForLoop(LPVOID lpParameter)
{
@ -430,6 +430,6 @@ DWORD WINAPI ThreadManager::threadForLoop(LPVOID lpParameter)
}
/*** To Do's ********************************************************************************
- Beschr<EFBFBD>nkung auf 'int' kann zu <EFBFBD>berlauf f<EFBFBD>hren, wenn mehr states in einer layer vorliegen.
==> Vielleicht mit class templates arbeiten
- Restriction to 'int' can lead to overflow if there are more states in a layer.
==> Maybe work with class templates
*********************************************************************************************/

View File

@ -16,7 +16,7 @@
using namespace std; // use standard library namespace
/*** Konstanten ******************************************************/
#define TM_SCHEDULE_USER_DEFINED 0
#define TM_SCHEDULE_STATIC 1
#define TM_SCHEDULE_DYNAMIC 2
@ -30,11 +30,11 @@ using namespace std; // use standard library namespace
#define TM_RETURN_VALUE_INVALID_PARAM 3
#define TM_RETURN_VALUE_UNEXPECTED_ERROR 4
/*** Makros ******************************************************/
/*** Strukturen ******************************************************/
/*** Klassen *********************************************************/
class ThreadManager
{