Hello Guys! Here in Italy there is a card game (with the napoletan cards) called "Gioco dell'asino"..

The card in a Napoletan deck are divided in 4 seeds and in 10 figures (total=40 cards). The rules are:

->Discard a "horse" (number 9 figure) from the deck;

->Distribute the remaining 39 cards to 2 Players;

->The Players have to discard two cards for each pair of cards with the seem figure (ex. two "10" or 2 "8" or 4 "2" etc";

->So the players remains with some figures; in each turn the player must draw a card from the opponent and discard (if possible) his pair of cards;

->The player who finish cards wins, and the one that remains with the "horse" loses.

Now i tried to do a C++ program that represents the two players that, after discarding cards, choose randomly one card form the opponent and (if possible) discard the pair of cards (counter-2) or nothing (counter +1). The only thing that should appear on the monitor is the Player who wins but it doesn't do anything. Anyone helps me? The code:

Code:#include <iostream> #include <ctime> using namespace std; void distribuisci(bool C1[][10],int &,bool [][10],int&); void eliminacarta(bool [][10],int&); void scegli(bool[][10],int&,bool [][10],int &); int main() { srand(time(0)); bool C1[4][10]={{0}}; bool C2[4][10]={{0}}; int cont1=0,cont2=0; distribuisci(C1,cont1,C2,cont2); eliminacarta(C1,cont1); eliminacarta(C2,cont2); do scegli(C1,cont1,C2,cont2); while(cont1!=0 and cont2!=0); if(cont1==0) cout<<"il giocatore 1 ha vinto!\n"; if(cont2==0) cout<<"il giocotare 2 ha vinto!\n"; return 0; } void distribuisci(bool C1 [][10],int & cont1, bool C2 [][10],int & cont2) { int r,c; for(int i=0;i<19;i++) { do { r=rand()%4; c=rand()%10; } while(C1[r][c]!=0 or (r==0 and c==9)); C1[r][c]=true; cont1++; } for(int i=0;i<20;i++) { do{ r=rand()%4; c=rand()%10; }while(C2[r][c]!=0 or C1[r][c]!=0 or (r==0 and c==9)); C2[r][c]=true; cont2++; } } void scegli (bool C1[][10],int &cont1,bool C2[][10],int &cont2) { int r,c; do{ r=rand()%4; c=rand()%10; } while(C1[r][c]==false or (r==0 and c==9)); C2[r][c]=true; C1[r][c]=false; cont2++; cont1--; eliminacarta(C2,cont2); do{ r=rand()%4; c=rand()%10; } while(C2[r][c]==false or (r==0 and c==9)); C1[r][c]=true; C2[r][c]=false; cont1++; cont2--; eliminacarta(C1,cont1); } void eliminacarta( bool C[][10],int &cont) { int carte=0; int passaggi=0; for(int j=0;j<10;j++) for(int i=0;i<4;i++) { if(C[i][j]==true) carte++; if(carte==1) passaggi++; if(carte==2) { cont-=2; C[i][j]=false; C[i-passaggi][j]=false; carte=0; passaggi=0; } } }