Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ThoughtWorks P2, Issue 03 Puzzle Solution
% The person who has to deploy to Mobile is not Max or Sam
% Neither Max or Charlie are fans of Copying Files
% The one who deploys quarterly does so to a Mobile target
% Andy deploys weekly
% The person making use of a third party PAAS is not Andy or Charlie
% Sam is either the Copying Files or the System Package enthusiast
% The person who makes VM Images is not Charlie and doesn’t own deploy to a PAAS
% The person who deploys to the PAAS is does so more frequently than the person who deploys to the Desktop
% Of the System Packaging fan and Charlie, one deploys monthly and the other deploys to Mobile
% The person who deploys to the IAAS is not Max
% Someone prefers application packages
more_frequent(more_than_weekly, weekly).
more_frequent(weekly, monthly).
more_frequent(monthly, quarterly).
more_frequent(quarterly, less_than_quarterly).
more_frequently(M, L) :- more_frequent(M, L) ; more_frequent(M, X), more_frequently(X, L).
does_the_deployment(People) :-
People = [person(max, _, _, _), person(charlie, _, _, _), person(andy, _, _, _), person(sam, _, _, _)],
member(person(_, mobile, _, _), People),
member(person(_, paas, _, _), People),
member(person(_, desktop, _, _), People),
member(person(_, iaas, _, _), People),
member(person(_, _, weekly, _), People),
member(person(_, _, monthly, _), People),
member(person(_, _, quarterly, _), People),
member(person(_, _, Missing_Frequency, _), People),
member(Missing_Frequency, [more_than_weekly, less_than_quarterly]),
member(person(_, _, _, copying_files), People),
member(person(_, _, _, system_packages), People),
member(person(_, _, _, vm_images), People),
member(person(_, _, _, application_packages), People),
Max = person(max, Max_Target, _, Max_Pkg_Pref),
Charlie = person(charlie, Charlie_Target, _, Charlie_Pkg_Pref),
Andy = person(andy, Andy_Target, Andy_Frequency, _),
Sam = person(sam, Sam_Target, _, Sam_Pkg_Pref),
Paas_Deployer = person(_, paas, Paas_Frequency, _),
Desktop_Deployer = person(_, desktop, Desktop_Frequency, _),
Mobile_Deployer = person(_, mobile, Mobile_Frequency, _),
member(Max, People),
member(Charlie, People),
member(Andy, People),
member(Sam, People),
member(Paas_Deployer, People),
member(Desktop_Deployer, People),
member(Mobile_Deployer, People),
Max_Target \= mobile,
Max_Target \= iaas,
Max_Pkg_Pref \= copying_files,
Charlie_Pkg_Pref \= copying_files,
Charlie_Pkg_Pref \= vm_images,
Charlie_Pkg_Pref \= system_packages,
Charlie_Target \= paas,
Andy_Frequency = weekly,
Andy_Target \= paas,
Sam_Target \= mobile,
member(Sam_Pkg_Pref, [copying_files, system_packages]),
more_frequently(Paas_Frequency, Desktop_Frequency),
Mobile_Frequency \= monthly,
member(person(_, mobile, quarterly, _), People),
member(person(_, _, weekly, system_packages), People),
\+member(person(_, paas, _, vm_images), People).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment