Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void computerTurn()
- {
- turn='C';
- if(setCount==0)
- {
- for(int i=0;i<6;i++)
- {
- set[i].suit=100;
- set[i].lorn=100;
- reset[i].suit=100;
- reset[i].lorn=100;
- }
- }
- int minimalLorn=8, numb=100, numbAvLorn=0;
- ScanArrays();
- if(setCount==0)
- {
- for(int i=0;i<computerCount;i++)
- {
- if(computer[i].lorn<=minimalLorn)
- {
- if(computer[i].suit!=trump.suit)
- {
- minimalLorn=computer[i].lorn;
- numb=i;
- }
- if(minimalLorn==0) break;
- }
- }
- }
- else
- {
- numbAvLorn=findAvailableLorns();
- for(int i=0;i<computerCount;i++)
- {
- for(int q=0;q<numbAvLorn;q++)
- {
- if(computer[i].lorn==availableLorns[q])
- {
- if(computer[i].suit!=trump.suit)
- {
- numb=i;
- break;
- }
- }
- }
- if(numb!=100) break;
- }
- }
- numbAvLorn=0;
- if(numb==100)
- {
- if(setCount==0)
- {
- for(int i=0;i<computerCount;i++)
- {
- if(computer[i].lorn<=minimalLorn&&minimalLorn<8)
- {
- minimalLorn=computer[i].lorn;
- numb=i;
- }
- if(minimalLorn==0) break;
- }
- }
- else if(pileCount==0)
- {
- numbAvLorn=findAvailableLorns();
- for(int i=0;i<computerCount;i++)
- {
- for(int q=0;q<numbAvLorn;q++)
- {
- if(computer[i].lorn==availableLorns[q])
- {
- numb=i;
- break;
- }
- }
- if(numb!=100) break;
- }
- }
- }
- if(numb==100&&setCount!=0)
- {
- for(int i=0;i<6;i++)
- {
- set[i].suit=100;
- set[i].lorn=100;
- reset[i].suit=100;
- reset[i].lorn=100;
- }
- for(int i=0;i<36;i++)
- {
- if(pile[i].description=='S')
- {
- pile[i].description='O';
- }
- }
- setCount=0;
- resetCount=0;
- wait=1;
- turn='P';
- dealCard();
- ScanArrays();
- return;
- }
- else
- {
- set[setCount]=computer[numb];
- for (int i = 0; i < 36; i++)
- {
- if(pile[i].lorn==computer[numb].lorn&&pile[i].suit==computer[numb].suit) pile[i].description='S';
- }
- computerCount--;
- setCount++;
- wait=1;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement