I'm trying to learn Prolog. This is my first steps with this language. As for exercise, I want to write a program that can recognize some poker hands (Straight flush, Four of a kind, Full house, etc.).
I'm looking for a good card representation in Prolog. I need to have the possibility to check if one card is bigger than the other if cards are suited and so one.
I have started with code:
rank_bigger(X, Y) :-
A > B.
That gives mi possibility to check if rank A is bigger than for example J.
But I'm not sure how to represent a single card. This representation should contain the rank of card and also suit. There is also some issue with Ace because Ace has rank 14 but it can be also 1 in straight.
So my question is how to represents cards if I want to make rules like:
isStraight(C1, C2, C3, C4, C5) :-
isStraightFlush(C1, C2, C3, C4, C5) :-
I'm sure that this is a kind of simple question if you know the language, but it is not so easy to 'switch' thinking from languages like C or python. :-)