Skip to content

Commit

Permalink
Merge pull request #9 from cagatayyildiz/master
Browse files Browse the repository at this point in the history
Commented a few predicates
  • Loading branch information
basarane committed Dec 9, 2015
2 parents e65c4d2 + fc5a80c commit c061b5c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cardData.pl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
:-module(cardData, [cardDataRaw/13, cardDataRawNoble/7]).
:-module(cardData, [cardDataRaw/13, cardDataRawNoble/7]).

cardDataRaw(1, 1, 0,3,0,0,0, 0, 1,0,0,0,0).
cardDataRaw(1, 2, 0,0,0,2,1, 0, 1,0,0,0,0).
Expand Down
7 changes: 7 additions & 0 deletions splendor.pl
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,16 @@
cardDataRaw(_,A,_,_,_,_,_,_,_,_,_,_,1),X=5
).

% given the card id, finds RequiredGems-BonusColor-Points info of the card
card(A, C) :-
cardData(A, C, _).

% finds id, point and colors_needed_to_be_visited_by_this_noble info of all nobles
allNobles(Z) :-
findall(Id-[N1, N2, N3, N4, N5, 0]-Point, cardDataRawNoble(Id, N1, N2, N3, N4, N5, Point), Z).

% finds the ids of cards in each deck
% initialCards(IdsOfCardsInTheFirstDeck,IdsOfCardsInTheSecondDeck,IdsOfCardsInTheThirdDeck)
initialCards(L1,L2,L3) :-
findall(X, cardData(X,_-_-_,1), L1),
findall(X, cardData(X,_-_-_,2), L2),
Expand All @@ -57,6 +61,8 @@
retractall(closeCards(_, _, _)),
assert(closeCards(SL1, SL2, SL3)).

% finds the first N elements of a list
% firstN (N, GivenList, SubList)
firstN(_,[], []).
firstN(N, [H|T], [H|R]) :-
N1 is N-1,
Expand Down Expand Up @@ -437,6 +443,7 @@
!
.

% reserves the first card of a deck (deck is chosen by the player)
playerReservesCardFromDeck(Player, DeckId, BackGems) :-
(
DeckId = 1, closeCards([CardId|_], _, _);
Expand Down

0 comments on commit c061b5c

Please sign in to comment.