surfbluedog
Technical User
I am writing a bridge program.
I am trying to count the number of points present in the hand according the the number of cards in each suit.
It works when i do a single query to it, but in t1 refuses to work. I really do not know what else to try.
Please please please help, I am desperate.
N is the number of cards in that suit, and X is the value asigned to N.
My code so far is as follows:
suit_count((5,_), X):-
X is 1.
suit_count((6, _), X):-
X is 2.
suit_count((7, _), X):-
X is 3.
suit_count((8, _), X):-
X is 4.
suit_count((0, _), X):-
X is 3.
suit_count((1, _), X):-
X is 2.
suit_count((2, _), X):-
X is 1.
total_suit_count((N, Hearts), (M, Diamonds), (O, Spades), (P, Clubs), Y3):-
suit_count((N, Hearts), X),
Y is X,
suit_count((M, Diamonds), X1),
Y1 is Y + X1,
suit_count((O, Spades), X2),
Y2 is Y1 + X2,
suit_count((P, Clubs), X3),
Y3 is Y2 + X3.
I am trying to count the number of points present in the hand according the the number of cards in each suit.
It works when i do a single query to it, but in t1 refuses to work. I really do not know what else to try.
Please please please help, I am desperate.
N is the number of cards in that suit, and X is the value asigned to N.
My code so far is as follows:
suit_count((5,_), X):-
X is 1.
suit_count((6, _), X):-
X is 2.
suit_count((7, _), X):-
X is 3.
suit_count((8, _), X):-
X is 4.
suit_count((0, _), X):-
X is 3.
suit_count((1, _), X):-
X is 2.
suit_count((2, _), X):-
X is 1.
total_suit_count((N, Hearts), (M, Diamonds), (O, Spades), (P, Clubs), Y3):-
suit_count((N, Hearts), X),
Y is X,
suit_count((M, Diamonds), X1),
Y1 is Y + X1,
suit_count((O, Spades), X2),
Y2 is Y1 + X2,
suit_count((P, Clubs), X3),
Y3 is Y2 + X3.