Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %team generator
- entrant(e_Isunari,59).
- entrant(e_a5vAstra,51).
- entrant(e_JXM,55).
- entrant(e_neoprotector,45).
- entrant(e_Rasengan,43).
- entrant(e_LittleChook,41).
- entrant(e_WorstLeonaNA,41).
- entrant(e_Cloudspire,35).
- entrant(e_kansasguy,33).
- entrant(e_Jupper,33).
- entrant(e_Tagster,33).
- entrant(e_Windstance,33).
- entrant(e_Storyteller1011,27).
- entrant(e_kingofthewalrus,27).
- entrant(e_TurtleSayuri,23).
- entrant(e_Praetors,19).
- entrant(e_Snowmelt,39).
- entrant(e_Shaunbiezel,37).
- entrant(e_Riceball13,41).
- point(Entrant,A) :- entrant(Entrant,A).
- pointTotal([],0).
- pointTotal([Ta|Tb],A) :- point(Ta,A2), pointTotal(Tb,A3), A is A2+A3.
- makeTeam(List, Team1, Team2) :- makeTeam(List, Team1, Team2, Pt1, Pt2, Ptd).
- makeTeam(List, Team1, Team2, Pt1, Pt2, Ptd) :- pick5(List, Team1), pick5(List, Team2), distinctLists(Team1, Team2), pointTotal(Team1, Pt1), pointTotal(Team2, Pt2), Ptd is Pt1-Pt2, absValLessThanX(Ptd,2).
- makeTeam(List, Team1, Team2, Pt1, Pt2, Ptd) :- pick5(List, Team1), pick5(List, Team2), distinctLists(Team1, Team2), pointTotal(Team1, Pt1), pointTotal(Team2, Pt2), Ptd is Pt1-Pt2, absValLessThanX(Ptd,2).
- absValLessThanX(P,X) :- P >= -1*X, P =< X.
- distinctLists([],_).
- distinctLists([T1a|T1b],T2) :- distinct(T2, T1a), distinctLists(T1b,T2).
- noDuplicates([],1).
- noDuplicates([La|Lb],A) :- distinct(Lb,La), !, noDuplicates(Lb,A).
- noDuplicates([La|Lb],0).
- % remove all of L1 from L2
- removeListFromList([],A,A).
- removeListFromList([L1a|L1b],L2,A) :- removeFromList(L2,L1a,NL2), removeListFromList(L1b,NL2,A).
- removeFromList([La],_,[La]).
- removeFromList([X|Lb],X,A) :- !, removeFromList(Lb,X,A).
- removeFromList([La|Lb],X,[La|A]) :- removeFromList(Lb,X,A).
- distinct([],_).
- distinct([La|Lb],La) :- fail.
- distinct([La|Lb],X) :- X \= La, distinct(Lb,X).
- %pick5(L,[P1,P2,P3,P4]) :- pick(L,P1), pick(L,P2), pick(L,P3), pick(L,P4), noDuplicates([P1,P2,P3,P4], NoDups), NoDups \= 0.
- pick5(L,[P1,P2,P3,P4,P5]) :- pick(L,P1), pick(L,P2), pick(L,P3), pick(L,P4), pick(L,P5), noDuplicates([P1,P2,P3,P4,P5], NoDups), NoDups \= 0.
- pick([],_) :- fail.
- pick([La|Lb],La).
- pick([La|Lb],P) :- pick(Lb,P).
- count([], A) :- A is 0.
- count([_|L1b], A) :- count(L1b, A2), A is A2+1.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement