Essay about Computation and Reasoning

1207 WordsFeb 16, 20085 Pages
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).…show more content…
%1cv) winnerofcategoriesinyear(_, []). winnerofcategoriesinyear(Year, [Categories | Category]):- actor(Name, Year, _, win, Categories), print(Name-Categories), nl, winnerofcategoriesinyear(Year, Category). winnerofcategoriesinyear(Year, [Categories | Category]):- actress(Name, Year, _, win, Categories), print(Name-Categories), nl, winnerofcategoriesinyear(Year, Category). winnerofcategoriesinyear(Year, [Categories | Category]):- directing(Name, Year, _, win, Categories), print(Name-Categories), nl, winnerofcategoriesinyear(Year, Category). winnerofcategoriesinyear(Year, [Categories | Category]):- bestpicture(Name, Year, _, win, Categories), print(Name-Categories), nl, winnerofcategoriesinyear(Year, Category). winnerofcategoriesinyear(Year, [_ | Category]):- print(no_data), nl, winnerofcategoriesinyear(Year, Category). Part II: Semantic Networks a) i) A class in this network is Settlement. ii) An individual is this network is Florence. iii) Settlement has the property number of universities (0) and capital of (Nowhere). Both these properties can be overridden and an example of this is London which is an instance of City which in turn is a subclass of Settlement. From Settlement, City gets the properties number of university (0) and the capital of (Nowhere). City overrides the property of number of universities and sets it to 1, which