for swap = 0:1
  win  = 0;
  lose = 0;
  for i = 1:1000
    actual = floor(rand()*3)+1;
    guess1 = floor(rand()*3)+1;
    if guess1 == actual
      reveal = floor(rand()*2)+1;
      if reveal == actual
	reveal = reveal + 1;
      end
    else
      if guess1 == 1 && actual == 2
	reveal = 3;
      elseif guess1 == 1 && actual == 3
	reveal = 2;
      elseif guess1 == 2 && actual == 1
	reveal = 3;
      elseif guess1 == 2 && actual == 3
	reveal = 1;
      elseif guess1 == 3 && actual == 1
	reveal = 2;
      elseif guess1 == 3 && actual == 2
	reveal = 1;
      end
    end
    if swap == 1
      if guess1 == 1 && reveal == 2
	guess2 = 3;
      elseif guess1 == 1 && reveal == 3
	guess2 = 2;
      elseif guess1 == 2 && reveal == 1
	guess2 = 3;
      elseif guess1 == 2 && reveal == 3
	guess2 = 1;
      elseif guess1 == 3 && reveal == 1
	guess2 = 2;
      elseif guess1 == 3 && reveal == 2
	guess2 = 1;
      end
    else
      guess2 = guess1;
    end
    if guess2 == actual
      win = win + 1;
    else
      lose = lose + 1;
    end
    %% only print trace for first 3 games
    if i <= 3
      actual
      guess1
      reveal
      swap
      guess2
    end
  end
  %% print results for each game play policy
  swap
  win / (win + lose)
end

