Пример #1
0
        internal void NewBoard(ChooserKinds chooserkind, int stepcount, int maxdepth)
        {
            _states     = new List <GameState>();
            _redostates = new List <GameState>();
            var board = CreateBoard();
            // always start with default values from game def, but should change before update
            var chooser = ChoiceMaker.Create(board, chooserkind, stepcount, maxdepth);

            AddState(chooser);
            Status = GameStatusKinds.Ready;
        }
Пример #2
0
        // Board is added after move generation and result checking
        void AddState(ChoiceMaker chooser)
        {
            if (chooser == null)
            {
                throw Error.NullArg("chooser");
            }
            if (chooser.Choice == null)
            {
                throw Error.NullArg("chooser.Choice");
            }
            _redostates.Clear();
            var state = new GameState {
                Board   = chooser.Choice.Board,
                Chooser = chooser,
            };

            _states.Add(state);
            Status = state.Board.HasResult ? GameStatusKinds.Finished : GameStatusKinds.Playing;
        }