function [ prob_noswitch, prob_switch ] = monty_hall_probabilities ( ndoors )

%*****************************************************************************80
%
%% monty_hall_probabilities() returns Monty Hall winning probabilities.
%
%  Discussion:
%
%    For no switch, you have 1/ndoors chance of picking the prize door.
%
%    For switch, you have 1/ndoors chance of switching from the prize door,
%    so a (ndoors-1)/ndoors chance of having a second chance at the prize.
%    In this second chance, there are ndoors-2 doors, and so you have a
%    1/(ndoors-2) chance of success.  Thus, overall, you have a
%    (ndoors-1)/ndoors * 1/(ndoors-2) chance of rejecting a nonprize 
%    initial selection and successfully choosing the prize on your
%    second guess.
%
%  Licensing:
%
%    This code is distributed under the MIT license. 
%
%  Modified:
%
%    26 August 2019
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer ndoors: the number of doors.
%
%  Output:
%
%    real prob_noswitch, prob_switch: the probability of winning the 
%    Monty Hall game with no-switch or switch strategies.
%
  prob_noswitch = 1.0 / ndoors;
  prob_switch = ( ndoors - 1 ) / ndoors / ( ndoors - 2 );

  return
end

