[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [pbmserv-dev] keeping constants with the board
luke@monitorlizards.co.uk wrote:
> Dear all,
>
> I am developing a game (cooperyoung), which will need to keep track
> of two private integers (ChosenRow, ChosenCol) throughout the game,
> which integers will be different for different games. How do I do
> this. I've tried to add
>
> private:
> static int ChosenRow
> static int ChosenCol to the CooperYoung class, but the integers are
> reset with every move. What should I do?
>
> Luke. (drp)
>
They need to be written to the game file.
I would probably use a ReadWriteIntList
class chosen:public ReadWriteIntList {
protected:
const char *Name(void) { return "chosen"; };
};
Then in Init use
chosen.Init(2);
in ReadBoard
return board.Read(game) || chosen.Read(game);
and in WriteBoard
return board.Write(game) * chosen.Write(game);
then you can refer to them as chosen[0] and chosen[1]
Ray - (hippo)