Advertisement
Guest User

Untitled

a guest
Apr 26th, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Prolog 1.06 KB | None | 0 0
  1. dominos([(0, 0), (0, 1), (0, 2), (0, 3), (0, 4), (0, 5), (0, 6),
  2.                  (1, 1), (1, 2), (1, 3), (1, 4), (1, 5), (1, 6),
  3.                          (2, 2), (2, 3), (2, 4), (2, 5), (2, 6),
  4.                                  (3, 3), (3, 4), (3, 5), (3, 6),
  5.                                          (4, 4), (4, 5), (4, 6),
  6.                                                  (5, 5), (5, 6),
  7.                                                          (6, 6)]).
  8.  
  9. frame([ [3, 1, 2, 6, 6, 1, 2, 2],
  10.         [3, 4, 1, 5, 3, 0, 3, 6],
  11.         [5, 6, 6, 1, 2, 4, 5, 0],
  12.         [5, 6, 4, 1, 3, 3, 0, 0],
  13.         [6, 1, 0, 6, 3, 2, 4, 0],
  14.         [4, 1, 5, 2, 4, 3, 5, 5],
  15.         [4, 1, 0, 2, 4, 5, 2, 0] ]).
  16.  
  17.  
  18. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  19.  
  20. put_dominos():-
  21.     dominos(Dominos),
  22.     frame(Frame),
  23.     possible_positions(Dominos, Frame, Positions),
  24.     place_dominos(Dominos, Positions, Result),
  25.     print().
  26.  
  27. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  28.  
  29. get_values((X, Y), X, Y).
  30.  
  31. possible_positions([], _, _).
  32.  
  33. possible_positions([X|Y], Frame, L) :-
  34.     get_values(X, A, B),
  35.     append([], X, L),
  36.     row_pos(),
  37.     column_pos().
  38.  
  39.  
  40.  
  41. check_row(_, [], _, _).
  42.  
  43. check_row(index, [H|T], X, Y) :-
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement