Skip to content

Instantly share code, notes, and snippets.

@skayred
Created October 31, 2011 14:33
Show Gist options
  • Save skayred/1327621 to your computer and use it in GitHub Desktop.
Save skayred/1327621 to your computer and use it in GitHub Desktop.
auto('ToyotaPrius', 'black', number('111', 'aaa'), owner('A', 'B'), '2011/11/11').
auto('NissanNote', 'white', number('222', 'bbb'), owner('C', 'D'), '2010/10/10').
auto('NissanNote', 'white', number('234', 'bcd'), owner('C', 'D'), '2010/10/10').
auto('VAZ 2114', 'purple', number('333', 'ccc'), owner('E', 'F'), '2009/09/09').
auto('VAZ 2113', 'red', number('444', 'ddd'), owner('G', 'H'), '2008/08/08').
auto('VAZ 2112', 'green', number('555', 'eee'), owner('I', 'J'), '2007/07/07').
auto('VAZ 2111', 'brown', number('666', 'fff'), owner('K', 'L'), '2006/06/06').
auto('VAZ 2110', 'none', number('777', 'ggg'), owner('M', 'N'), '2005/05/05').
auto('VAZ 2106', 'silver', number('888', 'hhh'), owner('O', 'P'), '2004/04/04').
auto('VAZ 2105', 'gold', number('999', 'iiii'), owner('Q', 'R'), '2003/03/03').
auto('VAZ 2105', 'bronze', number('000', 'jjj'), owner('S', 'T'), '2002/02/02').
get_number_by_mark_and_colour(MarkSearch, ColourSearch, NumberSearch) :- auto(MarkSearch, ColourSearch, NumberSearch, _, _),!.
get_numbers_by_mark_and_colours(MarkSearch, ColourSearch) :- auto(MarkSearch, ColourSearch, NumberSearch, _, _), write(NumberSearch), fail.
get_numbers :- write('Enter mark\n'), read(MARK), \==(MARK, ''), write('Enter colour\n'), read(COLOUR), \==(COLOUR, ''),
auto(MARK, COLOUR, NUMBER, _, _), write(NUMBER), fail.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment