# Computation and Reasoning

Topics: Academy Award for Best Actress, Object-oriented programming, Donald Knuth Pages: 6 (1205 words) Published: March 2, 2008
IN1002: Computation & Reasoning
Coursework 1: Semantic Networks & Prolog

Part I: Algorithms and Prolog

a)
i)
d=1947
i=1, d=1947+11 = 1958
i=2, no change to d
i=3, d=1958+11 = 1969
i=4, no change to d
i=5, n=8, d=1969+8 = 1977
i=6, n=6, d=1977+6 = 1983
i=7, n=4, d=1983+4 = 1987
Return: d= 1987

ii)
d=2007
i=6, d=2007-6 = 2001
i=5, d=2001-8 = 1993
i=4, d=1993-10 = 1983
i=3, no change to d
i=2, d=1983-10 = 1973
i=1, no change to d
Return: d= 1973

b)
Therefore consider the Actor -- Leading Role, Actress -- Leading Role, Best Picture and Directing in the years of 1973 and 1987.

%1bi)
actor('marlon brando',1973,'last tango in paris',nomination, actor). actor('jack lemmon',1973,'save the tiger',win, actor).
actor('jack nicholson',1973,'the last detail',nomination, actor). actor('al pacino',1973,serpico,nomination, actor).
actor('robert redford',1973,'the sting',nomination, actor).
actor('micheal douglas', 1987, 'wall street',win, actor).
actor('william hurt', 1987, 'broadcast news', nomination, actor). actor('marcello mastroianni', 1987, 'dark eyes', nomination, actor). actor('jack nicholson', 1987, ironweed, nomination, actor).
actor('robin williams', 1987, 'good morning, vietnam', nomination, actor).

actress('ellen burstyn',1973,'the exorcist',nomination, actress). actress('glenda jackson',1973,'a touch of class',win, actress). actress('marsha mason',1973,'cinderella liberty',nomination, actress). actress('barbra streisand',1973,'the way we were',nomination, actress). actress('joanne woodward',1973,'summer wishes, winter dreams',nomination, actress). actress(cher, 1987, moonstruck, win, actress).

actress('glenn close', 1987, 'fatal attraction', nomination, actress). actress('holly hunter', 1987, 'broadcast news', nomination, actress). actress('sally kirkland', 1987, anna, nomination, actress).

actress('meryl streep', 1987, ironweed, nomination, actress).

directing('george lucas',1973,'american graffitti',nomination, directing). directing('ingmar bergman',1973,'cries and whispers',nomination, directing). directing('william friedkin',1973,'the exorcist',nomination, directing). directing('bernardo bertolucci',1973,'last tango in paris',nomination, directing). directing('George Roy Hill',1973,'the_sting',win, directing). directing('adrian lyne', 1987, 'fatal attraction', nomination, directing). directing('john boorman', 1987, 'hope and glory', nomination, directing). directing('bernardo bertolucci', 1987, 'the last emperor', win, directing). directing('norman jewison', 1987, moonstruck, nomination, directing). directing('lasse hallstrom', 1987, 'my life as a dog', nomination, directing).

bestpicture('francis ford coppola',1973,'american graffitti', nomination, bestpicture). bestpicture('ingmar bergman',1973,'cries and whispers', nomination, bestpicture). bestpicture('william peter blatty',1973,'the exorcist', nomination, bestpicture). bestpicture('tony bill',1973,'the sting', win, bestpicture). bestpicture('melvin frank',1973,'a touch of class', nominated, bestpicture). bestpicture('james l. brooks', 1987, 'broadcast news', nomination, bestpicture). bestpicture('stanley r. jaffe', 1987, 'fatal attraction', nomination, bestpicture). bestpicture('john boorman', 1987, 'hope and glory', nomination, bestpicture). bestpicture('jeremy thomas', 1987, 'the last emperor', win, bestpicture). bestpicture('patrick palmer', 1987, moonstruck, nomination, bestpicture).

%1bii)
awards(46,1973).
awards(60,1987).

%1ci)
best_actress(Awards, Actress):-
awards(Awards, Year),
actress(Actress, Year, _, win, _).

%1cii)
best_actor_twice(Actor):-
actor(Actor, Year, _, nomination, _),
actor(Actor, Year1, _, nomination, _),
Year \= Year1.

%1ciii)
film_in_best_picture_and_best_directing(Year, Film):-
directing(_, Year, Film, _, _),
bestpicture(_, Year, Film1, _, _),
Film = Film1.

%1civ)
best_picture_in_years([]).
best_picture_in_years([Year | Years]):-
bestpicture(_, Year,...