Skip to content

Commit 0af4b07

Browse files
committed
fix cat bugs, bump python version
1 parent 071ff3a commit 0af4b07

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ task installPythonPackage(type: Exec) {
4444
if (project.findProperty('forceInstallPythonPackage') ?: false) {
4545
commandLine 'python', '-m', 'pip', 'install', '-e', 'engine/src/crossplay_python'
4646
} else {
47-
commandLine 'python', '-c', "import importlib.util,subprocess,sys; pkg='battlecode26'; importlib.util.find_spec(pkg) or subprocess.check_call([sys.executable,'-m','pip','install','-e',pkg])"
47+
commandLine 'python', '-c', "import importlib.util,subprocess,sys; assert sys.version_info[0] == 3 and sys.version_info[1] == 12, 'Error: Must use Python 3.12!'; pkg='battlecode26'; importlib.util.find_spec(pkg) or subprocess.check_call([sys.executable,'-m','pip','install','-e','engine/src/crossplay_python'])"
4848
}
4949
}
5050

engine/src/crossplay_python/python_docs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Battlecode 2026 Python Documentation
2-
v1.1.0
2+
v1.1.4
33

44
## Getting Started
55

engine/src/crossplay_python/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@
2626
],
2727
python_requires='>=3.12, <3.13',
2828
zip_safe=False,
29-
version='1.1.0',
29+
version='1.1.4',
3030
)

engine/src/main/battlecode/world/InternalRobot.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,8 +1252,12 @@ else if (this.type == UnitType.CAT) {
12521252
this.dir = dir;
12531253
}
12541254

1255-
if (getCatCornerByChirality().equals(this.catTargetLoc)) {
1256-
this.catState = CatStateType.SEARCH;
1255+
MapLocation[] partLocs = this.getAllPartLocations();
1256+
1257+
for (MapLocation partLoc : partLocs) {
1258+
if (partLoc.distanceSquaredTo(this.catTargetLoc) <= 2) {
1259+
this.catState = CatStateType.SEARCH;
1260+
}
12571261
}
12581262

12591263
// pounce towards target if possible
@@ -1269,7 +1273,7 @@ else if (this.type == UnitType.CAT) {
12691273
} else {
12701274
boolean isStuck = true;
12711275

1272-
for (MapLocation partLoc : this.getAllPartLocations()) {
1276+
for (MapLocation partLoc : partLocs) {
12731277
MapLocation nextLoc = partLoc.add(this.dir);
12741278

12751279
if (this.controller.canRemoveDirt(nextLoc)) {
@@ -1357,7 +1361,7 @@ else if (this.controller.canAttack(nextLoc)) {
13571361
ratVisible = false;
13581362

13591363
for (RobotInfo r : nearbyRobots) {
1360-
if (r.equals(this.catTarget)) {
1364+
if (r.getID() == this.catTarget.getID()) {
13611365
ratVisible = true;
13621366
this.catTargetLoc = this.catTarget.getLocation();
13631367
}

0 commit comments

Comments
 (0)