home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Complete Encyclopedia of Games 3
/
GAMES1000V3_d2.iso
/
card
/
cardws17
/
inc
/
poker.cdh
< prev
next >
Wrap
Text File
|
1994-02-06
|
1KB
|
68 lines
#ifndef cwspoker
#define cwspoker
{****determine si la pile (de 5 cartes) est une straight}
stack predicate Straight? is
var mi, ma : card,
m2, m3, m4 : boolean,
i : integer;
begin
mi:=[1] mod 13;
ma:=mi;
i:=2;
while i<=5 do
begin
if mi>([i] mod 13) then mi:=[i] mod 13
else if ma<([i] mod 13) then ma:=[i] mod 13;
i:=i+1;
end;
if (ma-mi)<>4 then return FALSE;
m2:=FALSE;
m3:=FALSE;
m4:=FALSE;
i:=1;
while i<=5 do
begin
if ([i] mod 13) = mi + 1 then m2:=TRUE
else if ([i] mod 13) = mi + 2 then m3:=TRUE
else if ([i] mod 13) = mi + 3 then m4:=TRUE;
i:=i+1;
end;
return (m2 and m3 and m4);
end;
{****determine si la pile (de 5 cartes) est une flush}
stack predicate Flush? is
var m1 : card,
i : integer;
begin
m1:=([1] / 13) mod 4;
i:=2;
while i<=5 do
begin
if (([i] / 13) mod 4)<>m1 then return FALSE;
i:=i+1;
end;
return TRUE;
end;
{****determine si la pile (de 5 cartes) contient deux valeur de cartes}
stack predicate OnlyTwo? is
var m1, m2 : card,
i : integer;
begin
m1:=[1] mod 13;
m2:=m1;
i:=2;
while i<=5 do
begin
if ([i] mod 13)<>m1 then
if m2=m1 then m2:=([i] mod 13)
else if ([i] mod 13)<>m2 then return FALSE;
i:=i+1;
end;
return TRUE;
end;
#endif