image thumbnail
from The Big Bang Theory Freindship Algorithm by Nathan Lorah
When Sheldon from the show, The Big Bang Theory, has trouble making friends he uses this algorithm!

BigBangTheoryFreindshipAlgorithm.m
% Big Bang Theory Freindship Algorithm

PlacePhoneCall = menu('Call them, do they answer?','Yes','No');

if PlacePhoneCall == 1;
    ShareMeal = menu('What is their response to, would you like to share a meal?','Yes','No');
    
else 
    fprintf('Leave message\n')
    fprintf('Wait for call back\n')
    ShareMeal = menu('When they call back, what is their response to, would you like to share a meal?','Yes','No');

end

if ShareMeal == 1;
    fprintf('Dine together\n')
    fprintf('BEGIN FREINDSHIP!\n')
    
else 
    Beverage = menu('What is their response to, would you enjoy a hot beverage?','Yes','No');
    
    if Beverage == 1
        WhatBeverage = menu('What beverage?','Tea','Coffee','Cocoa');
    
        if WhatBeverage == 1;
            fprintf('Have Tea\n')
            fprintf('BEGIN FREINDSHIP!\n')
    
        elseif WhatBeverage == 2;
            fprintf('Have Coffee\n')
            fprintf('BEGIN FREINDSHIP!\n')
    
        else 
            fprintf('Have Cocoa\n')
            fprintf('BEGIN FREINDSHIP!\n')
        
        end
    
    else 
        fprintf('You ask, "Recreational activity? Tell me one of your interests."\n')
        ShareInterestQ = menu('Do you share that interst they mentioned?','Yes','No');
        n0 = 0;
        
        if ShareInterestQ == 1 
            fprintf('You say, "Why don''t we do that together?"\n')
            fprintf('Partake in interest\n')
            fprintf('BEGIN FREINDSHIP!\n')
    
        else
            fprintf('You ask, "Tell me another of your interests."\n')
            ShareInterestQ2 = menu('Do you share that interest they mentioned?','Yes','No');

            if ShareInterestQ2 == 1
                fprintf('You say, "Why don''t we do that together?"\n')
                fprintf('Partake in interset\n')
                fprintf('BEGIN FREINDSHIP!\n')
   
            else
                fprintf('You ask, "Tell me another of your interests."\n')
                ShareInterestQ3 = menu('Do you share that interest they mentioned?','Yes','No');
    
                if ShareInterestQ3 == 1
                    fprintf('You say, "Why don''t we do that together?"\n')
                    fprintf('Partake in interset\n')                 
                    fprintf('BEGIN FREINDSHIP!\n')
   
                else
                    fprintf('You ask, "Tell me another of your interests."\n')
                    ShareInterestQ4 = menu('Do you share that interest they mentioned?','Yes','No');
            
                    if ShareInterestQ4 == 1
                        fprintf('You say, "Why don''t we do that together?"\n')
                        fprintf('Partake in interset\n')
                        fprintf('BEGIN FREINDSHIP!\n')
   
                    else
                        fprintf('You ask, "Tell me another of your interests."\n')
                        ShareInterestQ5 = menu('Do you share that interest they mentioned?','Yes','No');
                
                        if ShareInterestQ5 == 1
                            fprintf('You say, "Why don''t we do that together?"\n')
                            fprintf('Partake in interset\n')
                            fprintf('BEGIN FREINDSHIP!\n')
   
                        else
                            fprintf('You ask, "Tell me another of your interests."\n')
                            ShareInterestQ6 = menu('Do you share that interest they mentioned?','Yes','No');
                    
                            if ShareInterestQ6 == 1
                                fprintf('You say, "Why don''t we do that together?"\n')
                                fprintf('Partake in interset\n')
                                fprintf('BEGIN FREINDSHIP!\n')
   
                            else
                                fprintf('You ask, "Tell me another of your interests."\n')
                                ShareInterestQ7 = menu('Do you share that interest they mentioned?','Yes','No');
                        
                                if ShareInterestQ7 == 1
                                    fprintf('You say, "Why don''t we do that together?"\n')
                                    fprintf('Partake in interset\n')
                                    fprintf('BEGIN FREINDSHIP!\n')
   
                                else
                                    fprintf('You choose the least objectional interest, to you, they mentioned\n')
                                    fprintf('Partake in interest\n')
                                    fprintf('BEGIN FREINDSHIP!\n')
    
                                end
    
                            end
    
                        end
    
                    end
    
                end
            
            end
        
        end

    end
    
end

Contact us