Created
April 23, 2018 14:07
-
-
Save Thanatossan/6ce5a98a0ce367d85190592457f5995e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <string> | |
#include <ctime> | |
#include <cstdlib> | |
#include <iomanip> | |
using namespace std; | |
class bot{ | |
int side; // 1 is good -1 is bad | |
int character; // 1 is merlin 2 is servant of merlin 0 is assassin -1 is mondred -2 is servant of mondred | |
string name; //just a name | |
int botnumber; // bot number 1 number 2 blah blah... | |
int doubt; //use in bot function to tell what bot is doubt include player **if use in another fuction plaese set it 0 | |
int current; //if current is '0' it means undentify side '1' is mean good side and '2' is bad side **if use in another fuction plaese set it 0 | |
int king ; // to tell is a king or not 1 =king 0=a normal guy | |
int quest; // to tell who is going to do quest | |
public : | |
bot(int ,string ,int ,int ,int,int,int ) ; //to keep data of character | |
vector<int> getstates(); //to throw the bot construct into vector | |
}; | |
class Avalon | |
{ | |
int side; //player | |
int character; //player | |
string name; //player | |
int doubt; //player | |
int current; //player | |
int checkturn; | |
int scoreoverall; | |
int king ; // to tell is a king or not 1 =king 0=a normal guy | |
int quest; // to tell who is going to do quest | |
bot *bots; | |
public: | |
//fuction in game include player but except bot | |
void botfunction1(int numberofplayer,int m,bot *,bot *,bot *); | |
}; | |
bot::bot (int botnum,string n,int charac=0,int s=0,int d=0,int k=0,int q=0) { | |
name=n; | |
character=charac; | |
botnumber=botnum; | |
side= s; | |
doubt=d; | |
king=k; | |
quest=q; | |
} | |
vector<int> bot::getstates(){ | |
vector<int> bots; | |
bots.push_back(botnumber); //bots[0] | |
bots.push_back(character);//bots[1] | |
bots.push_back(doubt); //bots[2] | |
bots.push_back(side); //bots[3] | |
bots.push_back(king); //bot[4] | |
bots.push_back(quest);//bot[5] | |
return bots; // use this okay? | |
} | |
void Avalon::botfunction1(int n,int m,bot *bots1,bot *bots2,bot *bots3){ | |
vector<int> botstat1 = bots1->getstates(); | |
vector<int> botstat2 = bots2->getstates(); | |
vector<int> botstat3 = bots3->getstates(); | |
Avalon player; | |
if(king ==1){ | |
vector<int> random; | |
int temp=99; | |
if(checkturn==1){ | |
for(int i=0 ;i<m ;i++) { | |
int random=rand()%n; | |
if(temp==random){ | |
m--; | |
continue; | |
} | |
else{ | |
if(random ==1) botstat1[5]=1; | |
else if(random ==2) botstat2[5]=1; | |
else if(random ==3) botstat3[5]=1; | |
else if(random ==4) player.king=1; | |
} | |
//put the function quest for bot here | |
//and return to function quest for player if player have to go | |
} | |
} | |
else{ | |
if(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(botstat1[3]==-1) botstat1[5]==1; | |
else if(botstat2[3]==-1) botstat2[5]==1; | |
else if(botstat3[3]==-1) botstat3[5]==1; | |
else if (player.side==-1) player.quest==1; | |
} | |
else { | |
if(botstat1[3]==1) botstat1[5]==0; | |
else if(botstat2[3]==1) botstat2[5]==0; | |
else if(botstat3[3]==1) botstat3[5]==0; | |
else if(player.side==1) player.quest==0; | |
} | |
temp=random; | |
} | |
} | |
else{ //bot is good side | |
int random=0; | |
if(checkturn==1 || checkturn ==2){ | |
for(int i=0;i<2;i++){ | |
while(random==temp){ | |
random =rand()%n; | |
} | |
if(random==1){ | |
botstat1[5]=1; | |
} | |
else if(random==2){ | |
botstat2[5]=1; | |
} | |
else if(random==3){ | |
botstat3[5]=1; | |
} | |
else if(random==4){ | |
player.king=1; | |
} | |
int temp =random; | |
} | |
} | |
else{ | |
} | |
} | |
} | |
} | |
else { //bot is not a king | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment