Search in sources :

Example 1 with Chokepoint

use of bwta.Chokepoint in project BWAPI4J by OpenBW.

the class MainTest method testBWTA.

private void testBWTA() throws AssertionError {
    BWTA bwta = new BWTA();
    bwta.analyze();
    for (Region region : bwta.getRegions()) {
        System.out.println(region);
        for (Chokepoint choke : region.getChokepoints()) {
            System.out.println("   " + choke);
        }
    }
    TilePosition startLocation = this.bw.getInteractionHandler().self().getStartLocation();
    logger.debug("start location tile: {}", startLocation);
    Region startRegion = bwta.getRegion(startLocation);
    logger.debug("start region: {}", startRegion);
}
Also used : Chokepoint(bwta.Chokepoint) Region(bwta.Region) BWTA(bwta.BWTA)

Example 2 with Chokepoint

use of bwta.Chokepoint in project BWAPI4J by OpenBW.

the class TestListener method onFrame.

@Override
public void onFrame() {
    if (frame == 5) {
        System.out.println(this.bwta.getBaseLocations().size() + " base locations found.");
        for (BaseLocation base : this.bwta.getBaseLocations()) {
            System.out.println("location at " + base.getPosition().getX() + ", " + base.getPosition().getY());
        }
        System.out.println(this.bwta.getChokepoints().size() + " chokepoints found.");
        for (Chokepoint choke : this.bwta.getChokepoints()) {
            System.out.println("choke side 1: " + choke.getRegions().first + ", side 2: " + choke.getRegions().second);
        }
        System.out.println(this.bwta.getRegions().size() + " regions found.");
    }
    if (bw.getInteractionHandler().isKeyPressed(Key.K_D)) {
        System.out.println("D");
    }
    for (Player player : bw.getAllPlayers()) {
        System.out.println("Player " + player.getName() + " has minerals " + player.minerals());
    }
    this.frame++;
    System.err.println("tester");
    throw new RuntimeException("test");
}
Also used : Chokepoint(bwta.Chokepoint) BaseLocation(bwta.BaseLocation)

Aggregations

Chokepoint (bwta.Chokepoint)2 BWTA (bwta.BWTA)1 BaseLocation (bwta.BaseLocation)1 Region (bwta.Region)1