Advertisement
Guest User

fork_of_Npqqs1m4.cpp

a guest
Nov 18th, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.99 KB | None | 0 0
  1. //this is fork of https://pastebin.com/raw/Npqqs1m4
  2. #include "MyStrategy.h"
  3.  
  4. using namespace model;
  5. using namespace std;
  6.  
  7. void MyStrategy::move(const Player& me, const World& world, const Game& game, Move& move) {
  8.     if (world.getTickIndex() == 0) {
  9.         move.setAction(ActionType::CLEAR_AND_SELECT);
  10.         move.setRight(world.getWidth());
  11.         move.setBottom(world.getHeight());
  12.         return;
  13.     }
  14.  
  15.     if (world.getTickIndex() == 1) {
  16.         move.setAction(ActionType::ASSIGN);
  17.         move.setGroup(42);
  18.         return;
  19.     }
  20.  
  21.     if (world.getTickIndex() == 2) {
  22.         move.setAction(ActionType::ASSIGN);
  23.         move.setGroup(34);
  24.         return;
  25.     }
  26.  
  27.     if(me.getRemainingActionCooldownTicks()||world.getTickIndex()%5!=0)return; // <--- bug fixed
  28.     static int iter=0;iter++;auto k=iter%2?+1:-1;
  29.     move.setAction(ActionType::MOVE);
  30.     move.setX(k*world.getWidth() / 2.0);
  31.     move.setY(k*world.getHeight() / 2.0);
  32. }
  33.  
  34. MyStrategy::MyStrategy() { }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement