From 51c72445c9c9112cad86f5aed6ee7d015580be3c Mon Sep 17 00:00:00 2001 From: nikhilsardana <2018nsardana@tjhsst.edu> Date: Thu, 28 Jan 2021 01:43:54 -0500 Subject: [PATCH 1/2] only defend attack when nearby mucks --- src/jefferson/EnlightmentCenter.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/jefferson/EnlightmentCenter.java b/src/jefferson/EnlightmentCenter.java index d88c5e4..df34bab 100644 --- a/src/jefferson/EnlightmentCenter.java +++ b/src/jefferson/EnlightmentCenter.java @@ -416,7 +416,7 @@ else if (numPoliticians > numMuckrakers * poliMuckRatio()) { MapLocation enemyLocation = isMidGame ? optimalDestinationMidGame(true) : optimalDestination(true); System.out.println("Spawning killer: " + enemyLocation); int instr = SpawnDestinationFlag.INSTR_ATTACK; - if (rc.getRoundNum() > 300 && Math.random() < 0.5) { + if (rc.getRoundNum() > 300 && nearbyMuckraker) { instr = SpawnDestinationFlag.INSTR_DEFEND_ATTACK; } spawnRobotWithTracker(RobotType.POLITICIAN, optimalDir, 1000, enemyLocation, instr, spawnDestIsGuess); @@ -426,7 +426,7 @@ else if (numPoliticians > numMuckrakers * poliMuckRatio()) { MapLocation enemyLocation = isMidGame ? optimalDestinationMidGame(true) : optimalDestination(true); System.out.println("Spawning medium sized: " + enemyLocation); int instr = SpawnDestinationFlag.INSTR_ATTACK; - if (rc.getRoundNum() > 300 && Math.random() < 0.5) { + if (rc.getRoundNum() > 300 && nearbyMuckraker) { instr = SpawnDestinationFlag.INSTR_DEFEND_ATTACK; } spawnRobotWithTracker(RobotType.POLITICIAN, optimalDir, mediumSizedPolitician, enemyLocation, instr, spawnDestIsGuess); From 3ee33af9db02220e683259e21c88387b6ccd720d Mon Sep 17 00:00:00 2001 From: nikhilsardana <2018nsardana@tjhsst.edu> Date: Thu, 28 Jan 2021 03:18:33 -0500 Subject: [PATCH 2/2] back ECs produce only big pols when safe --- src/jefferson/EnlightmentCenter.java | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/jefferson/EnlightmentCenter.java b/src/jefferson/EnlightmentCenter.java index 667b3e7..a53ea24 100644 --- a/src/jefferson/EnlightmentCenter.java +++ b/src/jefferson/EnlightmentCenter.java @@ -167,7 +167,7 @@ public EnlightmentCenter(RobotController rc) throws GameActionException { public void run() throws GameActionException { super.run(); - if (currentRound == 600) { + if (currentRound == 1000) { rc.resign(); // TODO: remove; just for debugging } @@ -403,7 +403,10 @@ else if (numPoliticians > numMuckrakers * poliMuckRatio()) { else { //System.out.println("Medium Sized Politician threshold: " + mediumSizedPolitician); //System.out.println("Diluted Remaining Health:" + dilutedRemainingHealth); - if (Math.random() < 0.5) { // spawn defender + MapLocation tempEnemy = isMidGame ? optimalDestinationMidGame(false) : optimalDestination(false); + boolean allyCloser = existsAllyCloser(tempEnemy); + System.out.println("Only Produce large Politicians: " + (!nearbyMuckraker && allyCloser && currentRound >= 200 && remainingHealth == rc.getConviction())); + if (Math.random() < 0.5 && (nearbyMuckraker || !allyCloser || currentRound < 200 || remainingHealth != rc.getConviction())) { // spawn defender MapLocation enemyLocation = isMidGame ? optimalDestinationMidGame(false) : optimalDestination(false); System.out.println("Spawning defender: " + enemyLocation); int influence = rc.getRoundNum() < 50 ? 14 : 18; @@ -506,6 +509,25 @@ MapLocation optimalSlandererDestination() { } return 1.5; } + boolean existsAllyCloser(MapLocation enemyLoc) { + int dist2 = myLocation.distanceSquaredTo(enemyLoc); + if (numAllyECs == 0 && capturedAllyECLocsToInfluence.isEmpty()) { + return false; + } else { + for (int i=0; i