function win_lose_vector = Craps(num_games)
%Craps plays craps num_games times verbosely
% -1=lose 1=win
win_lose_vector=zeros(1,num_games);

%this for loop just runs the game as many times as the user requested. the
%real meat of the game of craps is INSIDE this loop...
for i=1:num_games
    %gets a starting roll
    roll=randi(6)+randi(6)
    
    %checks if the roll has won initially
    if roll==7 || roll==11
        %marks a win with a (+)1
        win_lose_vector(i)=1;
        fprintf('you win! \n');
        
    %checks if the roll has lost initially
    elseif roll==2 || roll==3 || roll==12
        %marks a loss with a -1
        win_lose_vector(i)=-1;
        fprintf('you lose :( \n');
        
    %if the starting roll has neither won or lost the game continues
    else 
        %we set the so called point value from the first roll
        fprintf(['the game continues! your point is:']);
        point=roll;
        point
        fprintf('press the spacebar to continue \n');
        pause; 
        
        %now we get a new roll
        roll=randi(6)+randi(6);
        fprintf('your new roll is');
        roll
        if roll==7
            fprintf('you win! \n');
        elseif roll==point
            fprintf('you lose :( \n');
        else
            fprintf('the game continues! \n')
        end
        
        %now we play the game by continuing to generate new roll_game
        %variables until roll_game becomes either 7 or point. Theoretically
        %we could have an infinite loop (or at least a computationally
        %infeasible loop) here, but the odds of that are
        %astronomically low, so i haven't built in any check against that.
        %probably a dumb coder's move, but i'm a dumb coder
        while roll~=7 && roll~=point;
            %this is just continually rolling the "game" throw
            roll=randi(6)+randi(6)
            if roll==7
                fprintf('you lose by rolling a 7 :( \n');
            elseif roll==point
                fprintf('you win by rolling your point! \n');
            else
            fprintf('the game continues! \n');
            fprintf('press the spacebar to continue \n');
            pause;
            end

        end
        
        %eventually roll_game is 7 or point. now we just check which it is
        %and mark appropriately if we've won or lost as above.
        if roll==7
            win_lose_vector(i)=-1;
        elseif roll==point
            win_lose_vector(i)=1;
        end
    end
end
%game over!
end


