/* ECP: FILEname=fig9_7.c */ /* 1*/ /* Return The Next Card */ /* 2*/ void /* 3*/ Deal( Card *OneCard ) /* 4*/ { /* 5*/ static Card TheCards[ TotalCards ]; /* 6*/ static int CardsUndealt = 0; /* 7*/ if( CardsUndealt < MinCards ) /* 8*/ { /* 9*/ NewDeck( TheCards, Decks ); /*10*/ CardsUndealt = TotalCards; /*11*/ } /*12*/ *OneCard = TheCards[ --CardsUndealt ]; /*13*/ } /* 1*/ /* Get Five Cards */ /* 2*/ void /* 3*/ DealHand( Card Hand[ ] ) /* 4*/ { /* 5*/ int i; /* 6*/ for( i = 0; i < 5; i++ ) /* 7*/ Deal( &Hand[ i ] ); /* 8*/ } /* 1*/ /* Returns Non Zero If All Cards Have Same Suit */ /* 2*/ int /* 3*/ IsFlush( const Card Hand[ ] ) /* 4*/ { /* 5*/ int i; /* 6*/ for( i = 1; i < 5; i++ ) /* 7*/ if( Hand[ i ].Suit != Hand[ 0 ].Suit ) /* 8*/ return 0; /* 9*/ return 1; /*10*/ }