Advertisement
chopical

bot?

Feb 3rd, 2020
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.78 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4. #include <fstream>
  5. #include <unistd.h>
  6. #include <cstdlib>
  7. #define string std::string
  8. #define endl std::endl
  9. #define cout std::cout
  10.  
  11. class brain {
  12.     bool evil=false;
  13.     void something(){
  14.         int min=0,max=1;
  15.         int r = rand()%(max-min + 1) + min;
  16.         if(r > 0) evil=!evil;
  17.     }
  18.     public:
  19.     bool isRunning=true;
  20.     bool goingToTurnEvil(){
  21.         bool tmp=evil;
  22.         something();
  23.         return tmp;
  24.     }
  25.     void dont(string cmd){
  26.         if(cmd == "goingToBeEvil"){
  27.             evil=false;
  28.             something();
  29.         }
  30.     }
  31. };
  32.  
  33. int main(int count,char **values){
  34.     brain Brain;
  35.     while(Brain.isRunning){
  36.         if(Brain.goingToTurnEvil()){
  37.             Brain.dont("goingToBeEvil");
  38.             cout << "im a bot" << endl;
  39.         }else{
  40.             cout << "im a good bot" << endl;
  41.         }
  42.         sleep(1);
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement