diff --git a/Allonsy.java b/Allonsy.java deleted file mode 100644 index 4836d5f..0000000 --- a/Allonsy.java +++ /dev/null @@ -1,125 +0,0 @@ -import cern.ais.gridwars.Coordinates; -import cern.ais.gridwars.UniverseView; -import cern.ais.gridwars.bot.PlayerBot; -import cern.ais.gridwars.command.MovementCommand; - -import java.lang.*; -import java.util.List; -import java.util.Random; - -public class Allonsy implements PlayerBot -{ - private static final long BATSIZE = 5; - - private boolean first = true; - - private Coordinates origin; - - private boolean deathmatch = false; - - private MovementCommand.Direction[] getOrder(Coordinates me, Coordinates target, int size){ - int dx; - int dy; - - MovementCommand.Direction dirs[] = new MovementCommand.Direction[4]; - - dy = target.getY() - me.getY(); - dx = target.getX() - me.getX(); - - - if(Math.abs(dx)>=Math.abs(dy)){ - if((dx>0 && Math.abs(dx)size/2)){ - dirs[0] = MovementCommand.Direction.LEFT; - dirs[3] = MovementCommand.Direction.RIGHT; - }else{ - dirs[0] = MovementCommand.Direction.RIGHT; - dirs[3] = MovementCommand.Direction.LEFT; - } - - if((dy>0 && Math.abs(dy)size/2)){ - dirs[1] = MovementCommand.Direction.UP; - dirs[2] = MovementCommand.Direction.DOWN; - }else{ - dirs[1] = MovementCommand.Direction.DOWN; - dirs[2] = MovementCommand.Direction.UP; - } - }else{ - if((dy>0 && Math.abs(dy)size/2)){ - dirs[0] = MovementCommand.Direction.UP; - dirs[3] = MovementCommand.Direction.DOWN; - }else{ - dirs[0] = MovementCommand.Direction.DOWN; - dirs[3] = MovementCommand.Direction.UP; - } - - if((dx>0 && Math.abs(dx)size/2)){ - dirs[1] = MovementCommand.Direction.LEFT; - dirs[2] = MovementCommand.Direction.RIGHT; - }else{ - dirs[1] = MovementCommand.Direction.RIGHT; - dirs[2] = MovementCommand.Direction.LEFT; - } - } - - return dirs; - } - - @Override public void getNextCommands(UniverseView universeView, List list) - { - long troops; - long batallion; - long tier; - int order; - - boolean done; - - Random rng = new Random(); - - MovementCommand.Direction dirs[]; - - if((!deathmatch) && universeView.getCurrentTurn()>universeView.getTurnLimit()/20){ - deathmatch = true; - } - - for (Coordinates c : universeView.getMyCells()) { - - if(first){ - first = false; - origin = c; - - } - - troops = universeView.getPopulation(c); - - dirs = getOrder(c ,origin,universeView.getUniverseSize()); - done = false; - if(deathmatch){ - for(MovementCommand.Direction coiso : dirs){ - if(!universeView.belongsToMe(c.getRelative(1,coiso))){ - list.add(new MovementCommand(c,coiso,troops)); - done = true; - break; - } - } - } - if(done) continue; - /* Breeding Base: */ - troops-=BATSIZE; - - tier = troops/BATSIZE; - - while(tier>0){ - for(MovementCommand.Direction coiso : dirs){ - if(tier>0){ - list.add(new MovementCommand(c,coiso,BATSIZE)); - tier--; - }else{ - break; - } - } - } - - - } - } -} diff --git a/BowTiesAreCool.java b/BowTiesAreCool.java deleted file mode 100644 index aa92c71..0000000 --- a/BowTiesAreCool.java +++ /dev/null @@ -1,130 +0,0 @@ -import cern.ais.gridwars.Coordinates; -import cern.ais.gridwars.UniverseView; -import cern.ais.gridwars.bot.PlayerBot; -import cern.ais.gridwars.command.MovementCommand; - -import java.lang.*; -import java.util.List; -import java.util.Random; - -public class BowTiesAreCool implements PlayerBot -{ - private static final long BATSIZE = 5; - - private boolean first = true; - - private Coordinates origin; - - private boolean deathmatch = false; - - private MovementCommand.Direction[] getOrder(Coordinates me, Coordinates target, int size){ - int dx; - int dy; - - MovementCommand.Direction dirs[] = new MovementCommand.Direction[4]; - - dy = target.getY() - me.getY(); - dx = target.getX() - me.getX(); - - - if(Math.abs(dx)>=Math.abs(dy)){ - if((dx>0 && Math.abs(dx)size/2)){ - dirs[0] = MovementCommand.Direction.LEFT; - dirs[3] = MovementCommand.Direction.RIGHT; - }else{ - dirs[0] = MovementCommand.Direction.RIGHT; - dirs[3] = MovementCommand.Direction.LEFT; - } - - if((dy>0 && Math.abs(dy)size/2)){ - dirs[1] = MovementCommand.Direction.UP; - dirs[2] = MovementCommand.Direction.DOWN; - }else{ - dirs[1] = MovementCommand.Direction.DOWN; - dirs[2] = MovementCommand.Direction.UP; - } - }else{ - if((dy>0 && Math.abs(dy)size/2)){ - dirs[0] = MovementCommand.Direction.UP; - dirs[3] = MovementCommand.Direction.DOWN; - }else{ - dirs[0] = MovementCommand.Direction.DOWN; - dirs[3] = MovementCommand.Direction.UP; - } - - if((dx>0 && Math.abs(dx)size/2)){ - dirs[1] = MovementCommand.Direction.LEFT; - dirs[2] = MovementCommand.Direction.RIGHT; - }else{ - dirs[1] = MovementCommand.Direction.RIGHT; - dirs[2] = MovementCommand.Direction.LEFT; - } - } - - return dirs; - } - - @Override public void getNextCommands(UniverseView universeView, List list) - { - long troops; - long batallion; - long tier; - int order; - Random rng = new Random(); - - MovementCommand.Direction dirs[]; - - if((!deathmatch) && universeView.getCurrentTurn()>universeView.getTurnLimit()/20){ - deathmatch = true; - } - - for (Coordinates c : universeView.getMyCells()) { - - if(first){ - first = false; - origin = c; - - } - - troops = universeView.getPopulation(c); - - if(deathmatch){ - if(!universeView.belongsToMe(c.getUp())){ - list.add(new MovementCommand(c,MovementCommand.Direction.UP, troops)); - continue; - } - if(!universeView.belongsToMe(c.getLeft())){ - list.add(new MovementCommand(c,MovementCommand.Direction.LEFT, troops)); - continue; - } - if(!universeView.belongsToMe(c.getRight())){ - list.add(new MovementCommand(c,MovementCommand.Direction.RIGHT, troops)); - continue; - } - if(!universeView.belongsToMe(c.getDown())){ - list.add(new MovementCommand(c,MovementCommand.Direction.DOWN, troops)); - continue; - } - } - /* Breeding Base: */ - troops-=BATSIZE; - - tier = troops/BATSIZE; - - dirs = getOrder(c ,origin,universeView.getUniverseSize()); - - while(tier>0){ - for(MovementCommand.Direction coiso : dirs){ - if(tier>0){ - list.add(new MovementCommand(c,coiso,BATSIZE)); - tier--; - }else{ - break; - } - } - } - - - } - } -} diff --git a/Escapatron.java b/Escapatron.java deleted file mode 100644 index 540e022..0000000 --- a/Escapatron.java +++ /dev/null @@ -1,108 +0,0 @@ -import cern.ais.gridwars.Coordinates; -import cern.ais.gridwars.UniverseView; -import cern.ais.gridwars.bot.PlayerBot; -import cern.ais.gridwars.command.MovementCommand; - -import java.lang.*; -import java.util.List; -import java.util.Random; - -public class Escapatron implements PlayerBot -{ - private static final long BATSIZE = 5; - - private boolean first = true; - - private Coordinates origin; - - private boolean chasing = true; - - private MovementCommand.Direction[] getOrder(Coordinates me, Coordinates target, int size){ - int dx; - int dy; - - MovementCommand.Direction dirs[] = new MovementCommand.Direction[4]; - - dy = target.getY() - me.getY(); - dx = target.getX() - me.getX(); - - - if(Math.abs(dx)>Math.abs(dy)){ - if((dx>0 && Math.abs(dx)size/2)){ - dirs[0] = MovementCommand.Direction.LEFT; - dirs[3] = MovementCommand.Direction.RIGHT; - }else{ - dirs[0] = MovementCommand.Direction.RIGHT; - dirs[3] = MovementCommand.Direction.LEFT; - } - - if((dy>0 && Math.abs(dy)size/2)){ - dirs[1] = MovementCommand.Direction.DOWN; - dirs[2] = MovementCommand.Direction.UP; - }else{ - dirs[1] = MovementCommand.Direction.UP; - dirs[2] = MovementCommand.Direction.DOWN; - } - }else{ - if((dy>0 && Math.abs(dy)size/2)){ - dirs[0] = MovementCommand.Direction.DOWN; - dirs[3] = MovementCommand.Direction.UP; - }else{ - dirs[0] = MovementCommand.Direction.UP; - dirs[3] = MovementCommand.Direction.DOWN; - } - - if((dx>0 && Math.abs(dx)size/2)){ - dirs[1] = MovementCommand.Direction.LEFT; - dirs[2] = MovementCommand.Direction.RIGHT; - }else{ - dirs[1] = MovementCommand.Direction.RIGHT; - dirs[2] = MovementCommand.Direction.LEFT; - } - } - - return dirs; - } - - @Override public void getNextCommands(UniverseView universeView, List list) - { - long troops; - long batallion; - long tier; - int order; - Random rng = new Random(); - - MovementCommand.Direction dirs[]; - - for (Coordinates c : universeView.getMyCells()) { - - if(first){ - first = false; - origin = c; - - } - - troops = universeView.getPopulation(c); - - /* Breeding Base: */ - troops-=BATSIZE; - - tier = troops/BATSIZE; - - dirs = getOrder(c ,origin,universeView.getUniverseSize()); - - while(tier>0){ - for(MovementCommand.Direction coiso : dirs){ - if(tier>0){ - list.add(new MovementCommand(c,coiso,BATSIZE)); - tier--; - }else{ - break; - } - } - } - - - } - } -} diff --git a/ExampleBot.java b/ExampleBot.java deleted file mode 100644 index 1b082a4..0000000 --- a/ExampleBot.java +++ /dev/null @@ -1,201 +0,0 @@ - - - -import cern.ais.gridwars.UniverseView; -import cern.ais.gridwars.Coordinates; -import cern.ais.gridwars.bot.PlayerBot; -import cern.ais.gridwars.command.MovementCommand; - -import java.util.List; -import java.util.Random; - - - -public class ExampleBot implements PlayerBot -{ - - private Coordinates oi; - private double d; - private double dist(UniverseView universeview){ - int enemy_x=0, enemy_y=0, friend_x=0, friend_y=0; - - int size= universeview.getUniverseSize(); - for(int i=0;i list){ - - // - // Coordinates start=myStartCoordinates(universeView); - int turn=universeView.getCurrentTurn(); - if(turn==1){ - for (Coordinates c : universeView.getMyCells()) { - long pop=universeView.getPopulation(c); - pop-=5; - long up=pop/4; - long down=pop/4; - long right=pop/4; - long left=pop-up-down-right; - - list.add(new MovementCommand(c, MovementCommand.Direction.UP, up)); - list.add(new MovementCommand(c, MovementCommand.Direction.DOWN, down)); - list.add(new MovementCommand(c, MovementCommand.Direction.LEFT, left)); - list.add(new MovementCommand(c, MovementCommand.Direction.RIGHT, right)); - oi=c; - d=dist(universeView); - } - } - else if(turn>1 && turn<70){ - for (Coordinates c : universeView.getMyCells()) { - int x=0,y=0, start_x=0,start_y=0; - long pop=universeView.getPopulation(c); - x=c.getX(); - y=c.getY(); - start_x=oi.getX(); - start_y=oi.getY(); - - if(pop>5){ - //right - if(x>start_x){ - list.add(new MovementCommand(c, MovementCommand.Direction.RIGHT, pop-5)); - } - //left - else if(x=start_y){ - list.add(new MovementCommand(c, MovementCommand.Direction.UP, pop-5)); - } - //down - else if(y0){ - switch(order){ - case 1: - list.add(new MovementCommand(c,MovementCommand.Direction.RIGHT, BATSIZE)); - tier--; - if(tier>0){ - list.add(new MovementCommand(c,MovementCommand.Direction.UP, BATSIZE)); - tier--; - } - if(tier>0){ - list.add(new MovementCommand(c,MovementCommand.Direction.LEFT, BATSIZE)); - tier--; - } - if(tier>0){ - list.add(new MovementCommand(c,MovementCommand.Direction.DOWN, BATSIZE)); - tier--; - } - break; - case 2: - list.add(new MovementCommand(c,MovementCommand.Direction.DOWN, BATSIZE)); - tier--; - if(tier>0){ - list.add(new MovementCommand(c,MovementCommand.Direction.RIGHT, BATSIZE)); - tier--; - } - if(tier>0){ - list.add(new MovementCommand(c,MovementCommand.Direction.UP, BATSIZE)); - tier--; - } - if(tier>0){ - list.add(new MovementCommand(c,MovementCommand.Direction.LEFT, BATSIZE)); - tier--; - } - break; - case 3: - list.add(new MovementCommand(c,MovementCommand.Direction.LEFT, BATSIZE)); - tier--; - if(tier>0){ - list.add(new MovementCommand(c,MovementCommand.Direction.DOWN, BATSIZE)); - tier--; - } - if(tier>0){ - list.add(new MovementCommand(c,MovementCommand.Direction.RIGHT, BATSIZE)); - tier--; - } - if(tier>0){ - list.add(new MovementCommand(c,MovementCommand.Direction.UP, BATSIZE)); - tier--; - } - break; - default: - list.add(new MovementCommand(c,MovementCommand.Direction.UP, BATSIZE)); - tier--; - if(tier>0){ - list.add(new MovementCommand(c,MovementCommand.Direction.LEFT, BATSIZE)); - tier--; - } - if(tier>0){ - list.add(new MovementCommand(c,MovementCommand.Direction.DOWN, BATSIZE)); - tier--; - } - if(tier>0){ - list.add(new MovementCommand(c,MovementCommand.Direction.RIGHT, BATSIZE)); - tier--; - } - break; - } - } - } - - } - - } -} diff --git a/ExpandingBot.java b/ExpandingBot.java deleted file mode 100644 index 198c22f..0000000 --- a/ExpandingBot.java +++ /dev/null @@ -1,47 +0,0 @@ -import cern.ais.gridwars.Coordinates; -import cern.ais.gridwars.UniverseView; -import cern.ais.gridwars.bot.PlayerBot; -import cern.ais.gridwars.command.MovementCommand; - -import java.lang.Long; -import java.util.List; - -public class ExpandingBot implements PlayerBot -{ - @Override public void getNextCommands(UniverseView universeView, List list) - { - long troops; - long batallion; - int tier; - - for (Coordinates c : universeView.getMyCells()) { - troops = universeView.getPopulation(c); - - /* Breeding Base: */ - troops-=10; - - tier = ((int) troops)/10; - - while(tier>0){ - list.add(new MovementCommand(c,MovementCommand.Direction.UP, (long)10)); - tier--; - if(tier>0){ - list.add(new MovementCommand(c,MovementCommand.Direction.DOWN, (long)10)); - tier--; - } - if(tier>0){ - list.add(new MovementCommand(c,MovementCommand.Direction.LEFT, (long)10)); - tier--; - } - if(tier>0){ - list.add(new MovementCommand(c,MovementCommand.Direction.RIGHT, (long)10)); - tier--; - } - } - - - - - } - } -} diff --git a/Fungus.java b/Fungus.java deleted file mode 100644 index 6181269..0000000 --- a/Fungus.java +++ /dev/null @@ -1,74 +0,0 @@ -import cern.ais.gridwars.Coordinates; -import cern.ais.gridwars.UniverseView; -import cern.ais.gridwars.bot.PlayerBot; -import cern.ais.gridwars.command.MovementCommand; - -import java.lang.Long; -import java.util.List; -import java.util.Random; - -public class RedShirt implements PlayerBot -{ - private boolean first = true; - private Coordinates origin; - private static final long BATSIZE = 5; - - private int[] getvector(Coordinates origin,Coordinates me,int size) - { - int result[] = new int[2]; - - result[0] = origin.getX() - me.getX(); - result[1] = origin.getY() - me.getY(); - - if(result[0]<-size/2){ - result[0]+=size; - }else if(result[0]>size/2){ - result[0]-=size; - } - - if(result[1]<-size/2){ - result[1]+=size; - }else if(result[1]>size/2){ - result[1]-=size; - } - - return result; - } - - @Override public void getNextCommands(UniverseView universeView, List list) - { - long troops; - long batallion; - long tier; - int order; - Random rng = new Random(); - int ratio; - - - - for (Coordinates c : universeView.getMyCells()) { - if(first){ - first = false; - origin = c; - } - - - - troops = universeView.getPopulation(c); - - - - /* Breeding Base: */ - troops-=BATSIZE; - - - - - /* - list.add(new MovementCommand(c,MovementCommand.Direction.RIGHT, BATSIZE));*/ - - - - } - } -} diff --git a/ItsATrap.java b/ItsATrap.java deleted file mode 100644 index bdbac0c..0000000 --- a/ItsATrap.java +++ /dev/null @@ -1,175 +0,0 @@ -import cern.ais.gridwars.Coordinates; -import cern.ais.gridwars.UniverseView; -import cern.ais.gridwars.bot.PlayerBot; -import cern.ais.gridwars.command.MovementCommand; - -import java.lang.*; -import java.util.List; -import java.util.Random; - -public class ItsATrap implements PlayerBot -{ - private static final long BATSIZE = 5; - - private boolean first = true; - - private Coordinates origin; - - private boolean deathmatch = false; - - private boolean escaping = false; - - private MovementCommand.Direction[] getOrder(Coordinates me, Coordinates target, int size){ - int dx; - int dy; - - int order; - Random rng = new Random(); - - MovementCommand.Direction dirs[] = new MovementCommand.Direction[4]; - - dy = target.getY() - me.getY(); - dx = target.getX() - me.getX(); - - if((!escaping) || deathmatch || dx*dx+dy*dy<=64){ - - order = rng.nextInt(4); - - switch(order){ - case 1: - dirs[0] = MovementCommand.Direction.RIGHT; - dirs[1] = MovementCommand.Direction.UP; - dirs[2] = MovementCommand.Direction.LEFT; - dirs[3] = MovementCommand.Direction.DOWN; - break; - case 2: - dirs[0] = MovementCommand.Direction.UP; - dirs[1] = MovementCommand.Direction.LEFT; - dirs[2] = MovementCommand.Direction.DOWN; - dirs[3] = MovementCommand.Direction.RIGHT; - break; - case 3: - - dirs[0] = MovementCommand.Direction.LEFT; - dirs[1] = MovementCommand.Direction.DOWN; - dirs[2] = MovementCommand.Direction.UP; - dirs[3] = MovementCommand.Direction.LEFT; - break; - default: - - dirs[0] = MovementCommand.Direction.UP; - dirs[1] = MovementCommand.Direction.LEFT; - dirs[2] = MovementCommand.Direction.DOWN; - dirs[3] = MovementCommand.Direction.RIGHT; - break; - } - } - - - - if(Math.abs(dx)>=Math.abs(dy)){ - if((dx>0 && Math.abs(dx)size/2)){ - dirs[0] = MovementCommand.Direction.LEFT; - dirs[3] = MovementCommand.Direction.RIGHT; - }else{ - dirs[0] = MovementCommand.Direction.RIGHT; - dirs[3] = MovementCommand.Direction.LEFT; - } - - if((dy>0 && Math.abs(dy)size/2)){ - dirs[1] = MovementCommand.Direction.UP; - dirs[2] = MovementCommand.Direction.DOWN; - }else{ - dirs[1] = MovementCommand.Direction.DOWN; - dirs[2] = MovementCommand.Direction.UP; - } - }else{ - if((dy>0 && Math.abs(dy)size/2)){ - dirs[0] = MovementCommand.Direction.UP; - dirs[3] = MovementCommand.Direction.DOWN; - }else{ - dirs[0] = MovementCommand.Direction.DOWN; - dirs[3] = MovementCommand.Direction.UP; - } - - if((dx>0 && Math.abs(dx)size/2)){ - dirs[1] = MovementCommand.Direction.LEFT; - dirs[2] = MovementCommand.Direction.RIGHT; - }else{ - dirs[1] = MovementCommand.Direction.RIGHT; - dirs[2] = MovementCommand.Direction.LEFT; - } - } - - return dirs; - } - - @Override public void getNextCommands(UniverseView universeView, List list) - { - long troops; - long batallion; - long tier; - int order; - - boolean done; - - Random rng = new Random(); - - MovementCommand.Direction dirs[]; - - if((!escaping) && (universeView.getCurrentTurn()/25)%4 == 3){ - deathmatch = true; - }else{ - deathmatch = false; - } - - if(universeView.getCurrentTurn()>50){ - escaping = true; - } - - if(universeView.getCurrentTurn()>100){ - escaping = false; - } - - for (Coordinates c : universeView.getMyCells()) { - - if(first){ - first = false; - origin = c; - - } - - troops = universeView.getPopulation(c); - - dirs = getOrder(c ,origin,universeView.getUniverseSize()); - done = false; - if(deathmatch){ - for(MovementCommand.Direction coiso : dirs){ - if(!universeView.belongsToMe(c.getRelative(1,coiso))){ - list.add(new MovementCommand(c,coiso,troops)); - done = true; - break; - } - } - } - if(done) continue; - /* Breeding Base: */ - troops-=BATSIZE; - - tier = troops/BATSIZE; - - while(tier>0){ - for(MovementCommand.Direction coiso : dirs){ - if(tier>0){ - list.add(new MovementCommand(c,coiso,BATSIZE)); - tier--; - }else{ - break; - } - } - } - - - } - } -} diff --git a/KobayashiMaru.java b/KobayashiMaru.java deleted file mode 100644 index ffa8fcb..0000000 --- a/KobayashiMaru.java +++ /dev/null @@ -1,48 +0,0 @@ -import cern.ais.gridwars.Coordinates; -import cern.ais.gridwars.UniverseView; -import cern.ais.gridwars.bot.PlayerBot; -import cern.ais.gridwars.command.MovementCommand; - -import java.lang.Long; -import java.util.List; - -public class KobayashiMaru implements PlayerBot -{ - public static final long BATSIZE = 5; - @Override public void getNextCommands(UniverseView universeView, List list) - { - long troops; - long batallion; - long tier; - - for (Coordinates c : universeView.getMyCells()) { - troops = universeView.getPopulation(c); - - /* Breeding Base: */ - troops-=BATSIZE; - - tier = troops/BATSIZE; - - while(tier/4>0){ - list.add(new MovementCommand(c,MovementCommand.Direction.UP, BATSIZE)); - tier--; - if(tier>0){ - list.add(new MovementCommand(c,MovementCommand.Direction.DOWN, BATSIZE)); - tier--; - } - if(tier>0){ - list.add(new MovementCommand(c,MovementCommand.Direction.LEFT, BATSIZE)); - tier--; - } - if(tier>0){ - list.add(new MovementCommand(c,MovementCommand.Direction.RIGHT, BATSIZE)); - tier--; - } - } - - - - - } - } -} diff --git a/NewRad.java b/NewRad.java deleted file mode 100644 index 14a8dc0..0000000 --- a/NewRad.java +++ /dev/null @@ -1,79 +0,0 @@ -import cern.ais.gridwars.Coordinates; -import cern.ais.gridwars.UniverseView; -import cern.ais.gridwars.bot.PlayerBot; -import cern.ais.gridwars.command.MovementCommand; - -import java.lang.Long; -import java.util.List; - -public class NewRad implements PlayerBot -{ - @Override public void getNextCommands(UniverseView universeView, List list) - { - long troops; - long mine; - - long go[] = new long[4]; - - /* 0 - UP - 1 - LEFT - 2 - DOWN - 3 - RIGHT */ - - - for (Coordinates c : universeView.getMyCells()) { - mine = universeView.getPopulation(c); - - troops = mine; - - if(troops>=25){ - troops-=5; - troops = troops/4; - - if(troops<5) continue; - - if( universeView.isEmpty(c.getUp()) || !universeView.belongsToMe(c.getUp())){ - go[0] = troops; - }else if(universeView.getPopulation(c.getUp()) < mine){ - go[0] = troops; - }else{ - go[0] = 0; - } - - if( universeView.isEmpty(c.getLeft()) || !universeView.belongsToMe(c.getLeft())){ - go[1] = troops; - }else if(universeView.getPopulation(c.getLeft()) < mine){ - go[1] = troops; - }else{ - go[1] = 0; - } - - if( universeView.isEmpty(c.getDown()) || !universeView.belongsToMe(c.getDown())){ - go[2] = troops; - }else if(universeView.getPopulation(c.getDown()) < mine){ - go[2] = troops; - }else{ - go[2] = 0; - } - - if( universeView.isEmpty(c.getRight()) || !universeView.belongsToMe(c.getRight())){ - go[3] = troops; - }else if(universeView.getPopulation(c.getRight()) < mine){ - go[3] = troops; - }else{ - go[3] = 0; - } - - list.add(new MovementCommand(c,MovementCommand.Direction.UP, go[0])); - list.add(new MovementCommand(c,MovementCommand.Direction.LEFT, go[1])); - list.add(new MovementCommand(c,MovementCommand.Direction.DOWN, go[2])); - list.add(new MovementCommand(c,MovementCommand.Direction.RIGHT, go[3])); - - } - - - - - } - } -} diff --git a/OwnTheWorld.java b/OwnTheWorld.java deleted file mode 100644 index e512551..0000000 --- a/OwnTheWorld.java +++ /dev/null @@ -1,127 +0,0 @@ -import cern.ais.gridwars.Coordinates; -import cern.ais.gridwars.UniverseView; -import cern.ais.gridwars.bot.PlayerBot; -import cern.ais.gridwars.command.MovementCommand; - -import java.lang.*; -import java.util.List; -import java.util.Random; - -public class OwnTheWorld implements PlayerBot -{ - private static final long BATSIZE = 5; - - private boolean first = true; - - private Coordinates origin; - - private boolean deathmatch = false; - - private MovementCommand.Direction[] getOrder(Coordinates me, Coordinates target, int size){ - int dx; - int dy; - - MovementCommand.Direction dirs[] = new MovementCommand.Direction[4]; - - dy = target.getY() - me.getY(); - dx = target.getX() - me.getX(); - - - if(Math.abs(dx)>=Math.abs(dy)){ - if((dx>0 && Math.abs(dx)size/2)){ - dirs[0] = MovementCommand.Direction.LEFT; - dirs[3] = MovementCommand.Direction.RIGHT; - }else{ - dirs[0] = MovementCommand.Direction.RIGHT; - dirs[3] = MovementCommand.Direction.LEFT; - } - - if((dy>0 && Math.abs(dy)size/2)){ - dirs[1] = MovementCommand.Direction.UP; - dirs[2] = MovementCommand.Direction.DOWN; - }else{ - dirs[1] = MovementCommand.Direction.DOWN; - dirs[2] = MovementCommand.Direction.UP; - } - }else{ - if((dy>0 && Math.abs(dy)size/2)){ - dirs[0] = MovementCommand.Direction.UP; - dirs[3] = MovementCommand.Direction.DOWN; - }else{ - dirs[0] = MovementCommand.Direction.DOWN; - dirs[3] = MovementCommand.Direction.UP; - } - - if((dx>0 && Math.abs(dx)size/2)){ - dirs[1] = MovementCommand.Direction.LEFT; - dirs[2] = MovementCommand.Direction.RIGHT; - }else{ - dirs[1] = MovementCommand.Direction.RIGHT; - dirs[2] = MovementCommand.Direction.LEFT; - } - } - - return dirs; - } - - @Override public void getNextCommands(UniverseView universeView, List list) - { - long troops; - long batallion; - long tier; - int order; - - boolean done; - - Random rng = new Random(); - - MovementCommand.Direction dirs[]; - - if((universeView.getCurrentTurn()/25)%4 == 3){ - deathmatch = true; - }else{ - deathmatch = false; - } - - for (Coordinates c : universeView.getMyCells()) { - - if(first){ - first = false; - origin = c; - - } - - troops = universeView.getPopulation(c); - - dirs = getOrder(c ,origin,universeView.getUniverseSize()); - done = false; - if(deathmatch){ - for(MovementCommand.Direction coiso : dirs){ - if(!universeView.belongsToMe(c.getRelative(1,coiso))){ - list.add(new MovementCommand(c,coiso,troops)); - done = true; - break; - } - } - } - if(done) continue; - /* Breeding Base: */ - troops-=BATSIZE; - - tier = troops/BATSIZE; - - while(tier>0){ - for(MovementCommand.Direction coiso : dirs){ - if(tier>0){ - list.add(new MovementCommand(c,coiso,BATSIZE)); - tier--; - }else{ - break; - } - } - } - - - } - } -} diff --git a/README.md b/README.md deleted file mode 100644 index d0543f2..0000000 --- a/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# gridwars_csc -Repositório para o Grid Wars diff --git a/RadExp.java b/RadExp.java deleted file mode 100644 index 04782c3..0000000 --- a/RadExp.java +++ /dev/null @@ -1,84 +0,0 @@ -import cern.ais.gridwars.Coordinates; -import cern.ais.gridwars.UniverseView; -import cern.ais.gridwars.bot.PlayerBot; -import cern.ais.gridwars.command.MovementCommand; - -import java.lang.Long; -import java.util.List; - -public class RadExp implements PlayerBot -{ - @Override public void getNextCommands(UniverseView universeView, List list) - { - long mine; - long troops; - long counter; - - char go[] = new char[4]; - - for (Coordinates c : universeView.getMyCells()) { - mine = universeView.getPopulation(c); - troops = mine; - - /* Breeding Base: */ - troops-=5; - - if(troops<=0) continue; - - go[0]=0; - go[1]=0; - go[2]=0; - go[3]=0; - - counter = 0; - - if((!universeView.belongsToMe(c.getUp())) || universeView.getPopulation(c.getUp()) < mine ){ - counter++; - go[0]++; - } - - if((!universeView.belongsToMe(c.getLeft())) || universeView.getPopulation(c.getLeft()) < mine ){ - counter++; - go[1]++; - } - - if((!universeView.belongsToMe(c.getDown())) || universeView.getPopulation(c.getDown()) < mine ){ - counter++; - go[2]++; - } - - if((!universeView.belongsToMe(c.getRight())) || universeView.getPopulation(c.getRight()) < mine ){ - counter++; - go[3]++; - } - - troops = troops / counter; - - if(troops<5) continue; - - if(go[3]==1){ - list.add(new MovementCommand(c,MovementCommand.Direction.RIGHT, troops)); - } - - if(go[2]==1){ - list.add(new MovementCommand(c,MovementCommand.Direction.DOWN, troops)); - } - - - if(go[1]==1){ - list.add(new MovementCommand(c,MovementCommand.Direction.LEFT, troops)); - } - - - - - if(go[0]==1){ - list.add(new MovementCommand(c,MovementCommand.Direction.UP, troops)); - } - - - - - } - } -} diff --git a/RafaelBot.java b/RafaelBot.java deleted file mode 100644 index cf07057..0000000 --- a/RafaelBot.java +++ /dev/null @@ -1,31 +0,0 @@ -import cern.ais.gridwars.Coordinates; -import cern.ais.gridwars.UniverseView; -import cern.ais.gridwars.bot.PlayerBot; -import cern.ais.gridwars.command.MovementCommand; - -import java.lang.Long; -import java.util.List; - -public class RafaelBot implements PlayerBot -{ - @Override public void getNextCommands(UniverseView universeView, List list) - { - long troops; - long batallion; - - for (Coordinates c : universeView.getMyCells()) { - troops = universeView.getPopulation(c); - if(troops>=20){ - list.add(new MovementCommand(c,MovementCommand.Direction.UP,(long) 10)); - troops-=10; - } - if(troops>=20){ - list.add(new MovementCommand(c,MovementCommand.Direction.LEFT,(long) 5)); - list.add(new MovementCommand(c,MovementCommand.Direction.RIGHT,(long) 5)); - troops-=10; - } - - - } - } -} diff --git a/RedShirt.java b/RedShirt.java deleted file mode 100644 index c6033e9..0000000 --- a/RedShirt.java +++ /dev/null @@ -1,105 +0,0 @@ -import cern.ais.gridwars.Coordinates; -import cern.ais.gridwars.UniverseView; -import cern.ais.gridwars.bot.PlayerBot; -import cern.ais.gridwars.command.MovementCommand; - -import java.lang.Long; -import java.util.List; -import java.util.Random; - -public class RedShirt implements PlayerBot -{ - public static final long BATSIZE = 5; - @Override public void getNextCommands(UniverseView universeView, List list) - { - long troops; - long batallion; - long tier; - int order; - Random rng = new Random(); - - for (Coordinates c : universeView.getMyCells()) { - troops = universeView.getPopulation(c); - - /* Breeding Base: */ - troops-=BATSIZE; - - tier = troops/BATSIZE; - - order = rng.nextInt(4); - - while(tier>0){ - switch(order){ - case 1: - list.add(new MovementCommand(c,MovementCommand.Direction.RIGHT, BATSIZE)); - tier--; - if(tier>0){ - list.add(new MovementCommand(c,MovementCommand.Direction.UP, BATSIZE)); - tier--; - } - if(tier>0){ - list.add(new MovementCommand(c,MovementCommand.Direction.LEFT, BATSIZE)); - tier--; - } - if(tier>0){ - list.add(new MovementCommand(c,MovementCommand.Direction.DOWN, BATSIZE)); - tier--; - } - break; - case 2: - list.add(new MovementCommand(c,MovementCommand.Direction.DOWN, BATSIZE)); - tier--; - if(tier>0){ - list.add(new MovementCommand(c,MovementCommand.Direction.RIGHT, BATSIZE)); - tier--; - } - if(tier>0){ - list.add(new MovementCommand(c,MovementCommand.Direction.UP, BATSIZE)); - tier--; - } - if(tier>0){ - list.add(new MovementCommand(c,MovementCommand.Direction.LEFT, BATSIZE)); - tier--; - } - break; - case 3: - list.add(new MovementCommand(c,MovementCommand.Direction.LEFT, BATSIZE)); - tier--; - if(tier>0){ - list.add(new MovementCommand(c,MovementCommand.Direction.DOWN, BATSIZE)); - tier--; - } - if(tier>0){ - list.add(new MovementCommand(c,MovementCommand.Direction.RIGHT, BATSIZE)); - tier--; - } - if(tier>0){ - list.add(new MovementCommand(c,MovementCommand.Direction.UP, BATSIZE)); - tier--; - } - break; - default: - list.add(new MovementCommand(c,MovementCommand.Direction.UP, BATSIZE)); - tier--; - if(tier>0){ - list.add(new MovementCommand(c,MovementCommand.Direction.LEFT, BATSIZE)); - tier--; - } - if(tier>0){ - list.add(new MovementCommand(c,MovementCommand.Direction.DOWN, BATSIZE)); - tier--; - } - if(tier>0){ - list.add(new MovementCommand(c,MovementCommand.Direction.RIGHT, BATSIZE)); - tier--; - } - break; - } - } - - - - - } - } -} diff --git a/TakingBackWhatIsRightfullyOurs.java b/TakingBackWhatIsRightfullyOurs.java deleted file mode 100644 index 25445e5..0000000 --- a/TakingBackWhatIsRightfullyOurs.java +++ /dev/null @@ -1,48 +0,0 @@ -import cern.ais.gridwars.Coordinates; -import cern.ais.gridwars.UniverseView; -import cern.ais.gridwars.bot.PlayerBot; -import cern.ais.gridwars.command.MovementCommand; - -import java.lang.Long; -import java.util.List; - -public class TakingBackWhatIsRightfullyOurs implements PlayerBot -{ - public static final long BATSIZE = 5; - @Override public void getNextCommands(UniverseView universeView, List list) - { - long troops; - long batallion; - long tier; - - for (Coordinates c : universeView.getMyCells()) { - troops = universeView.getPopulation(c); - - /* Breeding Base: */ - troops-=BATSIZE; - - tier = troops/BATSIZE; - - while(tier>0){ - list.add(new MovementCommand(c,MovementCommand.Direction.UP, BATSIZE)); - tier--; - if(tier>0){ - list.add(new MovementCommand(c,MovementCommand.Direction.DOWN, BATSIZE)); - tier--; - } - if(tier>0){ - list.add(new MovementCommand(c,MovementCommand.Direction.LEFT, BATSIZE)); - tier--; - } - if(tier>0){ - list.add(new MovementCommand(c,MovementCommand.Direction.RIGHT, BATSIZE)); - tier--; - } - } - - - - - } - } -} diff --git a/veH_tIn.java b/veH_tIn.java deleted file mode 100644 index 4d9ed70..0000000 --- a/veH_tIn.java +++ /dev/null @@ -1,198 +0,0 @@ -import cern.ais.gridwars.Coordinates; -import cern.ais.gridwars.UniverseView; -import cern.ais.gridwars.bot.PlayerBot; -import cern.ais.gridwars.command.MovementCommand; - -import java.lang.*; -import java.util.List; -import java.util.Random; - -public class veH_tIn implements PlayerBot -{ - private static final long BATSIZE = 5; - - private boolean first = true; - - private Coordinates getTarget(UniverseView universe) - { - int max = universe.getUniverseSize(); - int i,j; - - for(i=0;i<=max;i++){ - for(j=0;j<=max;j++){ - if((!universe.isEmpty(i,j)) && (!universe.belongsToMe(i,j))){ - return universe.getCoordinates(i,j); - } - } - } - return universe.getCoordinates(0,0); - } - - private Coordinates target; - - private boolean chasing = true; - - private MovementCommand.Direction[] getOrder(Coordinates me, Coordinates target, int size){ - int dx; - int dy; - - MovementCommand.Direction dirs[] = new MovementCommand.Direction[4]; - - dx = target.getY() - me.getY(); - dy = target.getX() - me.getX(); - - - if(Math.abs(dx)>Math.abs(dy)){ - if((dx>0 && Math.abs(dx)size/2)){ - dirs[0] = MovementCommand.Direction.RIGHT; - dirs[3] = MovementCommand.Direction.LEFT; - }else{ - dirs[0] = MovementCommand.Direction.LEFT; - dirs[3] = MovementCommand.Direction.RIGHT; - } - - if((dy>0 && Math.abs(dy)size/2)){ - dirs[0] = MovementCommand.Direction.UP; - dirs[3] = MovementCommand.Direction.DOWN; - }else{ - dirs[0] = MovementCommand.Direction.DOWN; - dirs[3] = MovementCommand.Direction.UP; - } - }else{ - if((dy>0 && Math.abs(dy)size/2)){ - dirs[0] = MovementCommand.Direction.UP; - dirs[3] = MovementCommand.Direction.DOWN; - }else{ - dirs[0] = MovementCommand.Direction.DOWN; - dirs[3] = MovementCommand.Direction.UP; - } - - if((dx>0 && Math.abs(dx)size/2)){ - dirs[1] = MovementCommand.Direction.RIGHT; - dirs[2] = MovementCommand.Direction.LEFT; - }else{ - dirs[1] = MovementCommand.Direction.LEFT; - dirs[2] = MovementCommand.Direction.RIGHT; - } - } - - return dirs; - } - - @Override public void getNextCommands(UniverseView universeView, List list) - { - long troops; - long batallion; - long tier; - int order; - Random rng = new Random(); - - MovementCommand.Direction dirs[]; - - if(first){ - first = false; - target = getTarget(universeView); - - } - - for (Coordinates c : universeView.getMyCells()) { - troops = universeView.getPopulation(c); - - /* Breeding Base: */ - troops-=BATSIZE; - - tier = troops/BATSIZE; - - - if(chasing){ - dirs = getOrder(c ,target,universeView.getUniverseSize()); - - for(MovementCommand.Direction coiso : dirs){ - if(tier>0){ - list.add(new MovementCommand(c,coiso,BATSIZE)); - tier--; - }else{ - break; - } - } - - - - }else{ - order = rng.nextInt(4); - - while(tier>0){ - switch(order){ - case 1: - list.add(new MovementCommand(c,MovementCommand.Direction.RIGHT, BATSIZE)); - tier--; - if(tier>0){ - list.add(new MovementCommand(c,MovementCommand.Direction.UP, BATSIZE)); - tier--; - } - if(tier>0){ - list.add(new MovementCommand(c,MovementCommand.Direction.LEFT, BATSIZE)); - tier--; - } - if(tier>0){ - list.add(new MovementCommand(c,MovementCommand.Direction.DOWN, BATSIZE)); - tier--; - } - break; - case 2: - list.add(new MovementCommand(c,MovementCommand.Direction.DOWN, BATSIZE)); - tier--; - if(tier>0){ - list.add(new MovementCommand(c,MovementCommand.Direction.RIGHT, BATSIZE)); - tier--; - } - if(tier>0){ - list.add(new MovementCommand(c,MovementCommand.Direction.UP, BATSIZE)); - tier--; - } - if(tier>0){ - list.add(new MovementCommand(c,MovementCommand.Direction.LEFT, BATSIZE)); - tier--; - } - break; - case 3: - list.add(new MovementCommand(c,MovementCommand.Direction.LEFT, BATSIZE)); - tier--; - if(tier>0){ - list.add(new MovementCommand(c,MovementCommand.Direction.DOWN, BATSIZE)); - tier--; - } - if(tier>0){ - list.add(new MovementCommand(c,MovementCommand.Direction.RIGHT, BATSIZE)); - tier--; - } - if(tier>0){ - list.add(new MovementCommand(c,MovementCommand.Direction.UP, BATSIZE)); - tier--; - } - break; - default: - list.add(new MovementCommand(c,MovementCommand.Direction.UP, BATSIZE)); - tier--; - if(tier>0){ - list.add(new MovementCommand(c,MovementCommand.Direction.LEFT, BATSIZE)); - tier--; - } - if(tier>0){ - list.add(new MovementCommand(c,MovementCommand.Direction.DOWN, BATSIZE)); - tier--; - } - if(tier>0){ - list.add(new MovementCommand(c,MovementCommand.Direction.RIGHT, BATSIZE)); - tier--; - } - break; - } - } - - } - - - } - } -}