C++ Ödev Yardım
-
Arkadaşlar C veya C++ da yapılmış bir pişti oyunu yapmam gerekio yardımlarınızı bekliom.Hazır yapılmışı da olabilir hiç yoktan iyidir.
-
Bi tane varmıs arsivimde, calısması lazım makinede C yok su an :)
Author : Pretty_Child & Bypass
Group : kod27
Email : pretty_child@turkstorm.org & root@turkh.org
/* Phisti
------------------
menu() <-- Display menu
about() <-- Display about
initCard() <-- Initialize card ( assign 0 and NULL)
generateCard() <-- Generate a card
drawCards( ) <-- Draw Closed Card
checkBeforeChosen() <-- Check if card is chosen before
calculatePoints () <-- Calculates values of cards on the table , when one of player get a round
drawClosedCards() <-- Draw cards of computer closely ,
checkSame() <-- Checks if two cards are same.
wait() <-- Pause
playComputer() <-- Check cards and returns position of card that computer play.
------------------------------------------------------------------------------------------------
*/
#include < stdio.h >
#include < stdlib.h >
#include < time.h >
#include < string.h >
#include < conio.h >
#include < assert.h >
#define NAME_LEN 10
#define SIDE ( char ) 186 /* Defining a character will be used for drawing cards */
#define MID ( char ) 205 /* Defining a character will be used for drawing cards */
#define CARD_NUM 4
#define TOTAL 52
#define PISHTI 10
#define SIZE 100
#define NDEBUG
enum{ USER , COMPUTER } ;
typedef struct {
int num;
char suit[ NAME_LEN ] ;
char ASCII ;
} Card ;
Card generateCard( void ) ;
void drawCards( Card *card , int cardNum ) ;
int checkBeforeChosen( Card *cards , int position );
void initCard ( Card *cards );
int checkPlayedCard( Card *chosenCards ) ;
int calculatePoints( Card cards[ ] , int total ) ;
void drawClosedCards( int cardNum ) ;
void menu( void ) ;
void about( void );
int checkSame( Card lastCard , Card chosenCard );
int playComputer( Card *cards , Card *lastCard , int total , Card *chosenCards );
void wait ( int seconds ) ;
void printCardNumber( int total );
char *printMessage( char *message , Card cards[ ] , int total );
void displayScores( int score1 , int score2 ) ;
void screen( char *message , int compScore , int userScore , int tableFlag , Card tableCard ,Card *playerCard,
int totalUser , int totalComputer );
int searchCard( Card *list , Card pivot ) ;
void puanlama( void );
int
main( void )
{
char choice ;
char *message;
Card *playerCards;
Card *computerCards ;
Card *deckCards;
Card *tableCards;
Card *chosenCards;
short int i,j ,k;
short int totalUser , totalComputer , round , cardPosition , userScore , compScore , tableFlag , lastFlag, endPoint;
message = ( char *)calloc( SIZE , sizeof( char ) );
playerCards = ( Card *)calloc( CARD_NUM , sizeof( Card ));
computerCards = ( Card *)calloc( CARD_NUM , sizeof( Card ));
deckCards = ( Card *)calloc( TOTAL , sizeof( Card ));
tableCards = ( Card *)calloc( TOTAL , sizeof( Card ));
chosenCards = ( Card *)calloc( TOTAL , sizeof( Card ));
strcpy( message , " " );
menu();
do{
choice = getchar( );
fflush( stdin ) ;
switch( choice )
{
case 'H':
case 'h':
about( );
menu();
break;
case 'P':
case 'p':
puanlama( );
menu();
break ;
case 'C':
case 'c':
printf( "\n\n\nCikis.......\n" );
exit( 1 ) ;
case 'B':
case 'b':
system( "cls" ) ;
printf( "\n\nBitis puanini giriniz > " );
scanf( "%d", &endPoint );
fflush( stdin );
while( endPoint <= 0 || endPoint > 999 )
{
printf( "\nLutfen 0 - 1000 arasinda bir sayi giriniz > " ) ;
scanf( "%d" , &endPoint );
fflush( stdin ) ;
}
break ;
default :
printf( "\nYanlis secim!! Lutfen bir daha giriniz > \n" );
break ;
}
}while( choice != 'B' && choice != 'b' );
userScore = 0 ;
compScore = 0 ;
srand( time( NULL ) );
while( userScore < endPoint && compScore < endPoint )
{
for( i = 0 ; i < TOTAL ; i++ )
{
initCard( &tableCards[ i ] );
initCard( &deckCards[ i ] );
initCard( &chosenCards[ i ] );
}
wait( 40 );
for ( i = 0 ; i < TOTAL ; i++ )
{
do{
deckCards[ i ] = generateCard( ) ;
}while( checkBeforeChosen( deckCards , i ) == -1 );
}
i--;
totalComputer = 0 ;
totalUser = 0 ;
for( j = 0 ; j < CARD_NUM ; j++ )
{
playerCards[ totalUser++ ] = deckCards[ i-- ];
computerCards[ totalComputer++ ] = deckCards[ i-- ] ;
tableCards[ j ] = deckCards[ i-- ] ;
chosenCards[ j ] = tableCards[ j ];
assert( !(checkSame( computerCards[ j ] , playerCards[ j ] ) && checkSame( computerCards[ j ] , tableCards[ j ] )
&& checkSame( tableCards[ j ] , playerCards[ j ] )));
}
for( j = 0 ; j < CARD_NUM ; j++)
for( k = j+1 ; k < CARD_NUM ; k++ )
assert( !checkSame( playerCards[ j ] , playerCards[ k ] ) && !checkSame( computerCards[ j ], computerCards[ k ] )
&& !checkSame( tableCards[ j ], tableCards[ k ] ) );
j = CARD_NUM - 1 ;
k = j ;
system( "cls" );
round = 1 ;
tableFlag = 1 ;
lastFlag = -1 ;
while( i >= 0 )
{
if( totalUser == 0 && totalComputer == 0 )
{
while( totalUser < CARD_NUM )
{
playerCards[ totalUser++ ] = deckCards[ i-- ];
computerCards[ totalComputer++ ] = deckCards[ i-- ] ;
assert( !checkSame( computerCards[ totalComputer-1 ] , playerCards[ totalUser-1 ] ));
}
if( i < 0 )
{
screen( message , compScore , userScore , tableFlag, tableCards[ j ] , playerCards ,
0 , 0 );
break;
}
}
screen( message , compScore , userScore , tableFlag, tableCards[ j ] , playerCards ,
totalUser , totalComputer );
if( round % 2 == 1 ) /* User */
{
printf( "\n\n" );
printf( "\nKart numarasini giriniz > " );
scanf( "%d" ,&cardPosition ) ;
fflush( stdin );
while( cardPosition < 1 || cardPosition > totalUser )
{
printf( "\nYanlis Secim!! Lutfen tekrar giriniz > " );
scanf( "%d" , &cardPosition );
fflush( stdin ) ;
}
if( tableFlag == 1 )
{
tableCards[ ++j ] = playerCards[ cardPosition - 1 ] ;
chosenCards[ ++k ] = tableCards[ j ] ;
if( ( playerCards[ cardPosition - 1 ].num == tableCards[ j - 1 ].num ||
playerCards[ cardPosition -1 ].num == 11 ) && j > 0 )
{
userScore += calculatePoints( tableCards , j+1 );
printMessage( message , tableCards , j );
do{
initCard( &tableCards[ j ] ) ;
j-- ;
}while( j >= 0 );
j = 0;
tableFlag = -1 ;
lastFlag = USER ;
}
}
else
{
tableCards[ j ] = playerCards[ cardPosition - 1 ];
chosenCards[ ++k ] = tableCards[ j ] ;
tableFlag = 1 ;
}
for( ; cardPosition < totalUser ; cardPosition++ )
playerCards[ cardPosition - 1 ] = playerCards[ cardPosition ] ;
initCard( &playerCards[ totalUser - 1] );
totalUser-- ;
}
else
{
printf( "\n\nBilgisayarin oynamasi icin bekleniyor..." );
wait( 200 ) ;
cardPosition = playComputer( computerCards , &tableCards[ j ], totalComputer , chosenCards ) ;
if( tableFlag == 1 )
{
tableCards[ ++j ] = computerCards[ cardPosition ] ;
chosenCards[ ++k ] = tableCards[ j ] ;
if( ( computerCards[ cardPosition ].num == tableCards[ j -1 ].num
|| computerCards[ cardPosition ].num == 11 ) && j > 0 )
{
compScore += calculatePoints( tableCards , j+1 );
printMessage( message , tableCards , j );
do{
initCard( &tableCards[ j ] ) ;
j-- ;
}while( j >= 0 );
j = 0;
tableFlag = -1 ;
lastFlag = COMPUTER;
}
}
else
{
tableCards[ j ] = computerCards[ cardPosition ];
chosenCards[ ++k ] = tableCards[ j ] ;
tableFlag = 1 ;
}
for( ; cardPosition < totalComputer ; cardPosition++ )
computerCards[ cardPosition ] = computerCards[ cardPosition + 1 ] ;
initCard( &computerCards[ totalComputer - 1] );
totalComputer-- ;
}
round++ ;
}
if( lastFlag == USER )
{
printf( "\nKartlar bitti!Masada kalan son kartlar size geliyor..." );
wait( 400 );
userScore += calculatePoints( tableCards , j+1 ) ;
}
else
{
printf( "\nKartlar bitti!Masada kalan son kartlar bilgisayar'a gidiyor..." );
wait( 400 );
compScore += calculatePoints( tableCards , j+1 );
}
system( "cls" ) ;
displayScores( userScore , compScore );
printf( "\n\nSonraki roundu baslatmak icin bir tusa basiniz..." );
getch();
}
system( "cls" );
displayScores( userScore , compScore );
printf( "\n\n\n" );
if( userScore > compScore )
printf( "Sen kazandin!!!" );
else if( userScore == compScore )
printf( "Berabere!!!" );
else
printf( "\nBilgisayar kazandi!" );
printf( "\n\n" );
free( message );
free( playerCards );
free( chosenCards ) ;
free( deckCards );
free( computerCards );
free( tableCards );
return ( 0 );
}
int searchCard( Card *list , Card pivot )
{
short int i , total = 0 ;
for( i = 0 ; list[ i ].num != 0 ; i++ )
if( list[ i ].num == pivot.num )
total++ ;
return( total );
}
int playComputer( Card *cards , Card *lastCard , int total , Card *chosenCards )
{
short int i ;
for( i = 0 ; i < total ; i++ )
if( cards[ i ].num == lastCard->num )
return( i );
for( i = 0 ; i < total ; i++ )
if( searchCard( chosenCards , cards[ i ] ) == 3 && cards[ i ].num != 11 )
return( i );
for( i = 0 ; i < total ; i++ )
if( searchCard( cards , cards[ i ] ) >= 2 )
return( i );
do{
i = rand() % total ;
} while( lastCard->num == 0 && cards[ i ].num == 11 && total != 1 );
return ( i );
}
/* This function pause process for a while.
* This function was taken from web site( www.cplusplus.com )
*/
void wait ( int seconds )
{
clock_t endwait = clock () + seconds * CLOCKS_PER_SEC / 100 ; /* Local variable with type clock_t */
while ( clock() < endwait ) ; /* While clock() is less than endwait */
}
void drawClosedCards( int cardNum )
{
short int i , l ; /* Local variables ( Counters ) */
putchar( '\n');
for( i = 0 ; i < cardNum ; i++ ) /* Draw top of cards */
{
printf( " " ) ;
putchar( ( char )201 );
for( l = 0 ; l < 13 ; l++ )
putchar( MID );
putchar( ( char )187 );
}
putchar( '\n');
for( i = 0 ; i < cardNum ; i++ )
printf( " %c*************%c", SIDE , SIDE );
putchar( '\n');
for( i = 0 ; i < cardNum ; i++ )
printf( " %c * * %c", SIDE , SIDE );
putchar( '\n');
for( i = 0 ; i < cardNum ; i++ )
printf( " %c * * %c", SIDE , SIDE );
putchar( '\n');
for( i = 0 ; i < cardNum ; i++ )
printf( " %c * * %c", SIDE , SIDE );
putchar( '\n');
for( i = 0 ; i < cardNum ; i++ )
printf( " %c * * %c" , SIDE , SIDE );
putchar( '\n');
for( i = 0 ; i < cardNum ; i++ )
printf( " %c * * %c", SIDE , SIDE );
putchar( '\n');
for( i = 0 ; i < cardNum ; i++ )
printf( " %c * %c", SIDE , SIDE );
putchar( '\n');
for( i = 0 ; i < cardNum ; i++ )
printf( " %c * * %c", SIDE , SIDE );
putchar( '\n');
for( i = 0 ; i < cardNum ; i++ )
printf( " %c * * %c" , SIDE , SIDE );
putchar( '\n');
for( i = 0 ; i < cardNum ; i++ )
printf( " %c * * %c" , SIDE , SIDE );
putchar( '\n');
for( i = 0 ; i < cardNum ; i++ )
printf( " %c * * %c" , SIDE , SIDE );
putchar( '\n');
for( i = 0 ; i < cardNum ; i++ )
printf( " %c * * %c" , SIDE , SIDE );
putchar( '\n');
for( i = 0 ; i < cardNum ; i++ )
printf( " %c*************%c" , SIDE , SIDE );
putchar( '\n');
for( i=0;i < cardNum ; i++ )
{
printf(" ");
putchar( ( char )200 ) ;
for( l = 0 ; l < 13 ; l++ )
printf( "%c", MID );
putchar( ( char )188 );
}
putchar( '\n');
}
/* Calculate the points of card which are on the table */
int calculatePoints( Card cards[ ] , int total )
{
short int i ;
short int sum ;
if( total == 2 && cards[ 0 ].num == cards[ 1 ].num && cards[ 0 ].num != 11 ) /* Phisti */
return ( PISHTI ) ;
else if ( total == 2 && cards[ 0 ].num == cards[ 1 ].num && cards[ 0 ].num == 11 ) /* Phisti Jack */
return( PISHTI * 2 ) ;
sum = 0 ;
for( i = 0 ; i <= total ; i++ )
{
if( ( cards[ i ].num > 10 && cards[ i ].num < 14 ) || cards[ i ].num == 1 )
sum++ ;
else if( cards[ i ].num == 10 )
!strcmp( cards[ i ].suit , "karo" ) ? sum += 2 : sum ++ ;
else if( cards[ i ].num == 2 && !strcmp( cards[ i ].suit , "sinek" ) )
sum++ ;
}
return( sum ) ;
}
/* Check card if it was chosen before or not
* Return -1 if it was chosen before, else return 1
*/
int checkBeforeChosen( Card *cards , int position )
{
short int i;
for( i = 0 ; i < position ; i ++ )
if( checkSame( cards[ position ] , cards[ i ] ) )
return ( -1 ) ;
return ( 1 ) ;
}
int checkSame( Card lastCard , Card chosenCard )
{
return ( (lastCard.num == chosenCard.num ) && ( lastCard.ASCII == chosenCard.ASCII )) ;
}/* Initialize the cards */
void initCard ( Card *cards )
{
strcpy( cards->suit , " " );
cards->num = 0 ;
cards->ASCII = ' ' ;
}
/* Generate Card */
Card generateCard( void )
{
short int *randNum ;
Card tempCard ;
randNum = ( short int *)malloc( sizeof ( short int ) ) ;
*randNum = 1 + ( rand() % 13 ) ;
tempCard.num = *randNum ;
*randNum = 1 + ( rand() %4 ) ;
switch( *randNum )
{
case 1 :
strcpy( tempCard.suit , "maca" ) ;
tempCard.ASCII = ( char )6 ;
break ;
case 2 :
strcpy( tempCard.suit , "kupa" ) ;
tempCard.ASCII = ( char )3 ;
break ;
case 3 :
strcpy( tempCard.suit , "karo" ) ;
tempCard.ASCII = ( char )4 ;
break ;
case 4:
strcpy( tempCard.suit , "sinek" ) ;
tempCard.ASCII = ( char )5 ;
break ;
}
free( randNum );
return ( tempCard ) ;
}
void printCardNumber( int total )
{
short int *i ;
i = ( short int *)malloc( sizeof( short int ) );
putchar( '\n' );
for( *i = 0 ; *i < total ; ( *i )++ ) /* Print "CARD" and card number at the top of all cards */
printf( "%13s %2d ", "CARD" , *i + 1 ) ;
free( i );
}
/* Draw Cards on the Screen */
void drawCards( Card *card , int total )
{
short int i , j ; /* Local variables ( Counters ) */
putchar( '\n' );
for( j = 0 ; j < total ; j++ )
{
printf( " " ) ;
putchar( ( char )201 );
for( i = 0 ; i < 13 ; i++ )
putchar( MID );
putchar( ( char )187 );
}
putchar( '\n' ) ;
for( j = 0 ; j < total ; j++ )
{
if( card[ j ].num == 1 )
printf( " %c %-2s %2s %c" , SIDE, "A" , "A", SIDE );
else if ( card[ j ].num == 11 )
printf( " %c %-2s %2s %c" , SIDE, "J" , "J", SIDE );
else if ( card[ j ].num == 12 )
printf( " %c %-2s %2s %c" , SIDE, "Q" , "Q", SIDE );
else if ( card[ j ].num == 13 )
printf( " %c %-2s %2s %c" , SIDE, "K" , "K", SIDE );
else if ( card[ j ].num == 2 || card[ j ].num == 3 )
printf( " %c %-1d %c %1d %c" , SIDE, card[ j ].num , card[ j ].ASCII , card[ j ].num, SIDE );
else if ( card[ j ].num < 11 && card[ j ].num > 3 )
printf( " %c %-2d %c %c %2d %c" , SIDE, card[ j ].num , card[ j ].ASCII ,card[ j ].ASCII, card[ j ].num, SIDE );
}
putchar( '\n' );
for( j = 0 ; j < total ; j++ )
printf( " %c %c %c %c",SIDE,card[ j ].ASCII , card[ j ].ASCII , SIDE );
putchar( '\n' );
for( j = 0 ; j < total ; j++ )
printf( " %c %c", SIDE , SIDE );
putchar( '\n' ) ;
for( j = 0 ; j < total ; j++ )
{
if( card[ j ].num == 7 || card[ j ].num == 8 || card[ j ].num == 10 )
printf( " %c %c %c", SIDE , card[ j ].ASCII , SIDE );
else
printf( " %c %c", SIDE , SIDE );
}
putchar( '\n' );
for( j = 0 ; j < total ; j++ )
{
if ( card[ j ].num > 8 && card[ j ].num < 14 )
printf( " %c %c %c %c", SIDE , card[ j ].ASCII , card[ j ].ASCII , SIDE );
else
printf( " %c %c", SIDE , SIDE );
}
putchar( '\n' ) ;
for( j = 0 ; j < total ; j++ )
{
if( card[ j ].num == 1 || card[ j ].num == 3 || card[ j ].num == 5 || card[ j ].num == 9 ||
( card[ j ].num > 10 && card[ j ].num < 14 ) )
printf( " %c %c %c", SIDE , card[ j ].ASCII , SIDE );
else if ( card[ j ].num == 6 || card[ j ].num == 7 || card[ j ].num == 8 )
printf( " %c %c %c %c", SIDE , card[ j ].ASCII , card[ j ].ASCII , SIDE );
else
printf( " %c %c", SIDE , SIDE );
}
putchar( '\n' ) ;
for( j = 0 ; j < total ; j++ )
printf( " %c %c", SIDE , SIDE );
putchar( '\n' ) ;
for( j = 0 ; j < total ; j++ )
{
if( card[ j ].num == 9 || card[ j ].num == 10 )
printf( " %c %c %c %c", SIDE , card[ j ].ASCII , card[ j ].ASCII , SIDE );
else
printf( " %c %c", SIDE , SIDE );
}
putchar( '\n' ) ;
for( j = 0 ; j < total ; j++ )
{
if( card[ j ].num == 8 || card[ j ].num == 10 )
printf( " %c %c %c", SIDE , card[ j ].ASCII , SIDE );
else if ( card[ j ].num == 11 )
printf( " %c %-2s %2s %c" , SIDE, "J" , "J", SIDE );
else if ( card[ j ].num == 12 )
printf( " %c %-2s %2s %c" , SIDE, "Q" , "Q", SIDE );
else if ( card[ j ].num == 13 )
printf( " %c %-2s %2s %c" , SIDE, "K" , "K", SIDE );
else
printf( " %c %c", SIDE , SIDE );
}
putchar( '\n' ) ;
for( j = 0 ; j < total ; j++ )
printf( " %c %c", SIDE , SIDE );
putchar( '\n' ) ;
for( j = 0 ; j < total ; j++ )
printf( " %c %c %c %c",SIDE,card[ j ].ASCII , card[ j ].ASCII , SIDE );
putchar( '\n' ) ;
for( j = 0 ; j < total ; j++ )
{
if( card[ j ].num == 1 )
printf( " %c %-2s %2s %c" , SIDE, "A" , "A", SIDE );
else if ( card[ j ].num == 11 )
printf( " %c %-2s %2s %c" , SIDE, "J" , "J", SIDE );
else if ( card[ j ].num == 12 )
printf( " %c %-2s %2s %c" , SIDE, "Q" , "Q", SIDE );
else if ( card[ j ].num == 13 )
printf( " %c %-2s %2s %c" , SIDE, "K" , "K", SIDE );
else if ( card[ j ].num == 2 || card[ j ].num == 3 )
printf( " %c %-1d %c %1d %c" , SIDE, card[ j ].num , card[ j ].ASCII , card[ j ].num, SIDE );
else if ( card[ j ].num < 11 && card[ j ].num > 3 )
printf( " %c %-2d %c %c %2d %c" , SIDE, card[ j ].num , card[ j ].ASCII ,
card[ j ].ASCII, card[ j ].num, SIDE );
}
putchar( '\n' );
for( j = 0 ; j < total ; j++ )
{
printf( " " );
putchar( ( char )200 ) ;
for( i = 0 ; i < 13 ; i++ )
putchar( MID );
putchar( ( char )188 );
}
putchar( '\n' );
}
/* This function only prints choices of main menu */
void menu( void )
{
short int *i ;
i = ( short int * )malloc( sizeof( short int ) );
printf( "\t\t\t\t %c", ( char )201 );
/* Title */
for( *i = 0 ; *i < 10 ; ( *i )++)
putchar( MID );
printf( "%c\n", ( char )187 );
printf( " \t\t\t\t %c PISTI %c\n ", SIDE , SIDE );
printf( "\t\t\t\t %c", ( char )200 );
for( *i = 0 ; *i < 10 ; ( *i )++)
putchar( MID );
printf( "%c\n", ( char )188 );
/* Choices */
printf( "\n\t\t\t\tMENU\n" );
printf( "\t\t\t\t-----\n" );
printf( "\n\t\t\t\tB.Basla\n" );
printf( "\n\t\t\t\tH.Hakkinda\n" );
printf( "\n\t\t\t\tP.Puanlama\n" );
printf( "\n\t\t\t\tC.Cikis\n" );
printf( "\nSeciminizi giriniz > " );
free( i );
}
void about(void)
{
system( "cls" ); /* Clean Screen */
/* Display instructions of game */
printf( "\t\t\t\t--------> ABOUT <---------" );
printf( "\n\n --> Oyun hatalari ve onerileriniz icin" );
printf( "\n\n\t\t\t\tE-mail : --> dufresne_649@hotmail.com <-- \n\n" );
printf( "\nPress any key to go back menu.. " );
getch( ) ;
system( "cls" );
putchar( '\n' );
}
char *printMessage( char *message , Card cards[ ] , int total )
{
if( total == 1 && cards[ 0 ].num == cards[ 1 ].num && cards[ 0 ].num != 11 )
strcpy( message , "PISTI!!!! 10 Puan Kazandirir" );
else if( total == 1 && cards[ 0 ].num == cards[ 1 ].num && cards[ 0 ].num == 11 )
strcpy( message, "JOKER PISTI!!!! 20 Puan Kazandirir" );
else if( cards[ total ].num == 11 )
sprintf( message , "Oyun kartlari Joker %c ile aldi", cards[ total ].ASCII );
else if( cards[ total ].num > 1 && cards[ total ].num < 11 )
sprintf( message , "%s %d %c %s %s", "Oyuncu kartlari " , cards[ total ].num ,cards[ total ].ASCII ,
cards[ total ].suit, " ile aldi." );
else if( cards[ total ].num == 12 )
sprintf( message , "%s %c %c %s %s", "Oyuncu kartlari " , 'Q' , cards[ total ].ASCII , cards[ total ].suit ," ile aldi." );
else if( cards[ total ].num == 13 )
sprintf( message , "%s %c %c %s %s", "Oyuncu kartlari " , 'K' , cards[ total ].ASCII , cards[ total ].suit , " ile aldi." );
else if( cards[ total ].num == 1 )
sprintf( message , "%s %c %c %s %s", "Oyuncu kartlari " , 'A' , cards[ total ].ASCII , cards[ total ].suit , " ile aldi." );
return ( message );
}
void displayScores( int score1 , int score2 )
{
printf( "\n Siz \t Bilgisayar\n" );
printf( " ---- \t --------\n" );
printf( "%6d \t %6d" , score1 , score2 );
}
void screen( char *message , int compScore , int userScore , int tableFlag , Card tableCard , Card *playerCard,
int totalUser , int totalComputer )
{
system( "cls" );
printf( "%s\n" , message );
strcpy( message , "" );
printf( "Bilgisayar'in puani = %d \t\t Sizin puaniniz = %d \n" , compScore , userScore );
drawClosedCards( totalComputer );
printf( "\n\n\n" );
tableFlag == 1 ? drawCards( &tableCard , 1 ): drawClosedCards( 0 );
printf( "\n\n\n" );
printCardNumber( totalUser ) ;
drawCards( &playerCard[ 0 ] , totalUser );
}
void puanlama( void )
{
system( "cls" );
printf( "\n\t\t\t\tPUANLAMA\n" );
printf( "\t\t\t\t---------\n" );
printf( "\n-->Kagit ustunlugu 3 puan\n" );
printf( "\n-->Pisti 10 puan\n" );
printf( "\n-->Joker Pisti 20 puan\n" );
printf( "\n-->A,K,Q ve J'lerin her biri 1 puan\n" );
printf( "\n-->10 Karo 2 puan diger 10'lar 1 puan\n" );
printf( "\n-->Sinek 2 , 1 puan\n" );
printf( "\n\nMenuye donmek icin bir tusa basiniz..." );
getch();
system( "cls" );
} -
hocam notepade atsaydın bare çok uzunmuş :D böle ödewmi olur ya :D
-
Sen ödeve başla takıldığın yerde biz yardım ederiz. Kimsenin senin ödevini sıfırdan yapmasını beklemiyorsun herhalde???
-
O nasıl ödev öyle ya, cpp ile pişti. İlginç..
-
oha :D hocam otur yapsana ödevini :) hazırları var tabii ki ama sen de yapabilirsin. pişti oyununun konseptini düşününce c++ syntaxlarını bilen birinin yapabileceği bir oyun, biraz uzun olur ama ödev sonuçta otur yaz, kendini geliştir.
