Advertisement
Guest User

Untitled

a guest
Nov 17th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. play: baralho(L2), shuffle(L2,L1), distribui(L1,M1,M2,L), aux_play([2,play,L,M1,M2]).
  2. aux_play([_,draw,_,_,_]):-writeln("Draw").
  3. aux_play([1,win,_,_,_]):-writeln("2 wins").
  4. aux_play([2,win,_,_,_]):-writeln("1 wins").
  5. aux_play([1,play,L,M1,M2]):- % levar sempre tudo que importa com esta funcao (baralho, maos dos jogadores)
  6. writeln("Computer plays:"),
  7. minimax([1,play,L,M1],[P,S,L1,NM],J), render(J), aux_play([P,S,L1,NM,M2]).
  8. aux_play([2,play,L,M1,M2]):-
  9. writeln("Human playing"),
  10. writeln("Na mao:"),
  11. print(M2),
  12. writeln("Inserir naipe valido"), flush_output,
  13. read(naipe),
  14. writeln("Inserir rank valido"), flush_output,
  15. read(rank),
  16. newHand(naipe,rank,M2,M),
  17. (drawGame(_,B2),S=draw;winGame(2,B2),S=win;S=play),
  18. aux_play([1,S,L1,M1,M]).
  19.  
  20.  
  21.  
  22. baralho(L) :- ranks(L1), allcards(L1,_,L).
  23. shuffle(L1, L):-random_permutation(L1,L).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement