Skip to content

Instantly share code, notes, and snippets.

@Thanatossan
Created April 26, 2018 10:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Thanatossan/6d84fb706159ed24ec646e4f98d99aad to your computer and use it in GitHub Desktop.
Save Thanatossan/6d84fb706159ed24ec646e4f98d99aad to your computer and use it in GitHub Desktop.
else if(bot1/แก้เป็นbot2/.king ==1){
vector<int> random;
int temp=99;
if(system.checkturn==1){
for(int i=0 ;i<2 ;i++) {
int random=rand()%players +1;
while(temp==random){
random=rand()%players +1;
}
if(random ==1) player.quest=1;
else if(random ==2) bot2//แก้เป็นbot1 .quest=1;
else if(random ==3) bot3.quest=1;
else if(random ==4) bot4.quest=1;
temp=random;
}
}
else{
if(bot1/แก้เป็นbot2/.side==-1){
for(int i=0;i<2;i++){
int temp=3 ;
int random=rand()%2;
while(random==temp){
random=rand()%2;
}
if(random==1){
if(bot2/แก้เป็นbot1/.side==-1) bot2.quest==1 ;
else if(bot3.side==-1) bot3.quest==1;
if(bot4.side==-1) bot4.quest==1;
else if (player.side==-1) player.quest==1;
}
else {
if(bot2/แก้เป็นbot1/.side==-1) bot2.quest==-1;
else if(bot3.side==-1) bot3.quest==-1;
if(bot4.side==-1) bot4.quest==-1;
else if (player.side==-1) player.quest==-1;
}
temp=random;
}
}
else{ //bot is good side
int random=0;
if(system.checkturn==1 || system.checkturn ==2){
for(int i=0;i<2;i++){
while(random==temp){
random =rand()%players;
}
if(random==1){
bot2/แก้เป็นbot1/.quest=1;
}
else if(random==2){
bot3.quest=1;
}
else if(random==3){
bot4.quest=1;
}
else if(random==4){
player.quest=1;
}
int temp =random;
}
}
else{
int temp=0;
for(int l=0 ; l<1 ; l++){
int i=rand()%bot2/แก้เป็นbot1/.doubt;
int j=rand()%bot3.doubt;
int k=rand()%bot4.doubt;
int m=rand()%player.doubt;
vector<int> doubltofall;
doubltofall.push_back(i);
doubltofall.push_back(j);
doubltofall.push_back(k);
doubltofall.push_back(m);
int min=999;
for(int i=0;i<doubltofall.size();i++){
if(doubltofall[i]<min){
min=doubltofall[i];
}
if(min=i){bot2/แก้เป็นbot1/.quest =1; temp++; }
else if(min=j) {bot3.quest =1 ; temp++;}
else if(min=k) {bot4.quest =1 ;temp++; }
else if(min=m){player.quest =1; temp++; }
if(temp==2){
if(player.quest==0) {player.quest=1;
}
else {bot2/แก้เป็นbot1/.quest=1;
}
temp--;
}
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment