CS计算机代考程序代写 prolog % The characters in the world.
% The characters in the world.
character(monica).
character(simon).
character(oswald).
character(naomi).
% character genders
gender_spec(monica, she).
gender_spec(simon, he).
gender_spec(oswald, they).
gender_spec(naomi, she).
% Fallback if we forget to specify a character gender.
gender_default(they).
% Determine character gender.
gender(Char, Gender) :- gender_spec(Char, Gender).
gender(Char, Gender) :- gender_default(Gender), + gender_spec(Char, _).
% pejorative expressions that characters like to use.
pejorative_spec(monica, nerd).
pejorative_spec(simon, n00b).
pejorative_spec(oswald, doofus).
pejorative_spec(naomi, nimrod).
% Generic pejorative fallback.
pejorative_default(jerk).
% Determine character pejorative expression
pejorative(Char, Perj) :- pejorative_spec(Char, Perj).
pejorative(Char, Perj) :- pejorative_default(Perj), + pejorative_spec(Char, _).
% characters who are mutual enemies.
enemies(monica, oswald).
enemies(simon, oswald).
enemies(naomi, monica).
% the symmetric closure of enemies/2
enemy_of(Enemy1, Enemy2) :-
enemies(Enemy1, Enemy2) ;
enemies(Enemy2, Enemy1).
% characters who are mutual friends.
friends(monica, simon).
friends(oswald, naomi).
% the symmetric closure of friends/2
friend_of(Friend1, Friend2) :-
friends(Friend1, Friend2) ;
friends(Friend2, Friend1).
:- set_prolog_flag(double_quotes, atom).
% events that have happened previously, tagged by the social action
% event_occurred(embarrassed, X, Y, String) means that X did something to embarrass Y
% and String is how you would describe it.
event_occurred(embarrassed, monica, oswald, “I broke up with Oswald in the middle of his tennis match just to make him loose”).
event_occurred(embarrassed, oswald, monica, “I told Monica the party was casual and she showed up to the formal in shorts and a tee shirt”).
event_occurred(embarrassed, simon, oswald, “I tripped Oswald in the cafeteria and made him spill all of his food”).
social_exchange_available(bond_over_complaining_about_mutually_disliked_person, [Friend1, Friend2, Enemy, EmbarrassDesc, EnemyGender, Pejorative]) :-
friend_of(Friend1, Friend2),
enemy_of(Friend1, Enemy),
enemy_of(Friend2, Enemy),
event_occurred(embarrassed, Friend2, Enemy, EmbarrassDesc),
gender(Enemy, EnemyGender),
pejorative(Friend1, Pejorative).