Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1.  
  2. /*Changes the board*/
  3. changeBoard(Nlinha,Ncoluna,Peca,TabIn,TabOut):-
  4. setLinha(Nlinha,Ncoluna,Peca,TabIn,TabOut).
  5.  
  6. setLinha(1,Ncoluna,Peca,[Linha|Resto],[NovaLinha|Resto]):-
  7. setColuna(Ncoluna,Peca,Linha,NovaLinha).
  8. setLinha(N,Ncoluna,Peca,[Linha|Resto],[Linha|MaisLinhas]):-
  9. N > 1,
  10. Next is N-1,
  11. setLinha(Next,Ncoluna,Peca,Resto,MaisLinhas).
  12.  
  13. setColuna(1,Peca,[_|Resto],[Peca|Resto]).
  14. setColuna(N,Peca,[X|Resto],[X|Mais]):-
  15. N > 1,
  16. Next is N-1,
  17. setColuna(Next,Peca,Resto,Mais).
  18. /*Changes the board*/
  19.  
  20. placeTriangle(Line,Column,Option,Board,NewBoard):- true.
  21.  
  22. loopRectangle(8,Column,Peca,Board,Board).
  23. loopRectangle(Line,Column,Peca,Board,NewBoard):-
  24. changeBoard(Line,Column,Peca,Board,AuxBoard),
  25. NewLine is Line+1,
  26. loopRectangle(NewLine,Column,Peca,AuxBoard,NewBoard).
  27.  
  28. placeRectangle(1,Option,Board,NewBoard):-
  29. loopRectangle(2,2,rectangle1,Board,NewBoard).
  30. placeRectangle(_,Option,Board,NewBoard):-
  31. true.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement