Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*Changes the board*/
- changeBoard(Nlinha,Ncoluna,Peca,TabIn,TabOut):-
- setLinha(Nlinha,Ncoluna,Peca,TabIn,TabOut).
- setLinha(1,Ncoluna,Peca,[Linha|Resto],[NovaLinha|Resto]):-
- setColuna(Ncoluna,Peca,Linha,NovaLinha).
- setLinha(N,Ncoluna,Peca,[Linha|Resto],[Linha|MaisLinhas]):-
- N > 1,
- Next is N-1,
- setLinha(Next,Ncoluna,Peca,Resto,MaisLinhas).
- setColuna(1,Peca,[_|Resto],[Peca|Resto]).
- setColuna(N,Peca,[X|Resto],[X|Mais]):-
- N > 1,
- Next is N-1,
- setColuna(Next,Peca,Resto,Mais).
- /*Changes the board*/
- placeTriangle(Line,Column,Option,Board,NewBoard):- true.
- loopRectangle(8,Column,Peca,Board,Board).
- loopRectangle(Line,Column,Peca,Board,NewBoard):-
- changeBoard(Line,Column,Peca,Board,AuxBoard),
- NewLine is Line+1,
- loopRectangle(NewLine,Column,Peca,AuxBoard,NewBoard).
- placeRectangle(1,Option,Board,NewBoard):-
- loopRectangle(2,2,rectangle1,Board,NewBoard).
- placeRectangle(_,Option,Board,NewBoard):-
- true.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement