In Smart Game Library there is a file named SgMove.h which defined game move. It's says : "Useful for game that can encode moves as positive integers". I used it in my implementations of SOS game.
typedef int SgMove;
SgMove in Sos is a value in the range [0...number of switches], It's actually the move's index in the moves array in state .
For example, the SosUctPlayer class that implements SosPlayer, has a member function genMove that receive a game state (of type SosState) and return the next move to execute of type SgMove. There are many places in my code when I had to use SgMove as integer value. For example, when a random agent has to use rand() function in order to choose the next move to execute, which chooses a random number among integers, I used static_cast to do that.
Today I thought that maybe it's not a good programing. We may want, in the future, to use this game for others values of switches and I have to change all the static_cast I did.
In Smart Game Library there is a file named SgMove.h which defined game move. It's says : "Useful for game that can encode moves as positive integers". I used it in my implementations of SOS game. typedef int SgMove;
SgMove in Sos is a value in the range [0...number of switches], It's actually the move's index in the moves array in state .
For example, the SosUctPlayer class that implements SosPlayer, has a member function genMove that receive a game state (of type SosState) and return the next move to execute of type SgMove. There are many places in my code when I had to use SgMove as integer value. For example, when a random agent has to use rand() function in order to choose the next move to execute, which chooses a random number among integers, I used static_cast to do that.
Today I thought that maybe it's not a good programing. We may want, in the future, to use this game for others values of switches and I have to change all the static_cast I did.
I hope you understand now.
Vered.