Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- play: baralho(L2), shuffle(L2,L1), distribui(L1,M1,M2,L), aux_play([2,play,L,M1,M2]).
- aux_play([_,draw,_,_,_]):-writeln("Draw").
- aux_play([1,win,_,_,_]):-writeln("2 wins").
- aux_play([2,win,_,_,_]):-writeln("1 wins").
- aux_play([1,play,L,M1,M2]):- % levar sempre tudo que importa com esta funcao (baralho, maos dos jogadores)
- writeln("Computer plays:"),
- minimax([1,play,L,M1],[P,S,L1,NM],J), render(J), aux_play([P,S,L1,NM,M2]).
- aux_play([2,play,L,M1,M2]):-
- writeln("Human playing"),
- writeln("Na mao:"),
- print(M2),
- writeln("Inserir naipe valido"), flush_output,
- read(naipe),
- writeln("Inserir rank valido"), flush_output,
- read(rank),
- newHand(naipe,rank,M2,M),
- (drawGame(_,B2),S=draw;winGame(2,B2),S=win;S=play),
- aux_play([1,S,L1,M1,M]).
- baralho(L) :- ranks(L1), allcards(L1,_,L).
- shuffle(L1, L):-random_permutation(L1,L).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement