Ejemplo n.º 1
0
        private GamblersWorldState PlaySingleGame(GamblersWorldState initialState)
        {
            var state = initialState;

            while (!_world.IsTerminal(state))
            {
                var action = MaxAction(state);

                state = _world.NextState(state, action);
            }

            return(state);
        }
Ejemplo n.º 2
0
 public double Reward(
     GamblersWorldState oldState,
     GamblersWorldState newState,
     GamblersWorldAction action)
 {
     if (_world.IsTerminal(oldState))
     {
         return(0.0);
     }
     if (newState.DollarsInHand == _world.DollarsToWin)
     {
         return(1);
     }
     return(0);
 }