Skip to content

Commit 3185085

Browse files
Merge branch 'master' into release-config
2 parents f8c4511 + c003c09 commit 3185085

File tree

10 files changed

+44
-15
lines changed

10 files changed

+44
-15
lines changed

client/src/constants.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { schema } from 'battlecode-schema'
22

3-
export const GAME_VERSION = '2.0.0'
4-
export const SPEC_VERSION = '2.0.0'
3+
export const GAME_VERSION = '2.0.1'
4+
export const SPEC_VERSION = '2.0.1'
55
export const BATTLECODE_YEAR: number = 2024
66
export const MAP_SIZE_RANGE = {
77
min: 30,

client/src/playback/Actions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ export const ACTION_DEFINITIONS: Record<schema.Action, typeof Action> = {
160160
// To dicuss
161161
}
162162
draw(match: Match, ctx: CanvasRenderingContext2D): void {
163-
const radius = 3.3 // in between the two sizes of the explosion
163+
const radius = Math.sqrt(4)
164164
const map = match.currentTurn.map
165165
const loc = map.indexToLocation(this.target)
166166
const coords = renderUtils.getRenderCoords(loc.x, loc.y, map.dimension, true)

engine/src/main/battlecode/common/GameConstants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public class GameConstants {
99
/**
1010
* The current spec version the server compiles with.
1111
*/
12-
public static final String SPEC_VERSION = "2.0.0";
12+
public static final String SPEC_VERSION = "2.0.1";
1313

1414
// *********************************
1515
// ****** MAP CONSTANTS ************

engine/src/main/battlecode/common/GlobalUpgrade.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,13 @@ public enum GlobalUpgrade {
2121
/**
2222
* Capture upgrade increases the dropped flag delay from 4 rounds to 12 rounds. It also decreases the movement penalty for holding a flag by 8.
2323
*/
24-
CAPTURING(0, 0, 8, -8);
24+
CAPTURING(0, 0, 8, -8),
25+
26+
/**
27+
* !DO NOT USE!
28+
* NOOP upgrade that is mostly equivalent to ATTACK and exists for backwards compatability
29+
*/
30+
ACTION(0, 0, 0, 0);
2531

2632
/**
2733
* How much base attack changes

engine/src/main/battlecode/common/MapInfo.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,27 @@ public boolean isSpawnZone() {
7777
return spawnZone > 0;
7878
}
7979

80+
/**
81+
* Returns 1 if this square is a Team A spawn zone,
82+
* 2 if this square is a Team B spawn zone, and
83+
* 0 if this square is not a spawn zone.
84+
*
85+
* @return 1 or 2 if the square is a Team A or B spawn zone, respectively; 0 otherwise
86+
*
87+
* @battlecode.doc.costlymethod
88+
*/
89+
public int getSpawnZoneTeam() {
90+
return spawnZone;
91+
}
92+
8093
/**
8194
* Returns the team that owns that spawn zone at this location, or Team.NEUTRAL if the location is not a spawn zone.
8295
*
8396
* @return The team that owns the spawn zone, or Team.NEUTRAL
8497
*
8598
* @battlecode.doc.costlymethod
8699
*/
87-
public Team getSpawnZoneTeam() {
100+
public Team getSpawnZoneTeamObject() {
88101
return spawnZone == 0 ? Team.NEUTRAL : (spawnZone == 1 ? Team.A : Team.B);
89102
}
90103

@@ -158,4 +171,4 @@ public String toString(){
158171
'}';
159172
}
160173

161-
}
174+
}

engine/src/main/battlecode/instrumenter/bytecode/resources/MethodCosts.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ battlecode/common/MapInfo/toString 15 fal
9494
battlecode/common/MapInfo/isWall 2 false
9595
battlecode/common/MapInfo/isDam 2 false
9696
battlecode/common/MapInfo/getSpawnZoneTeam 2 false
97+
battlecode/common/MapInfo/getSpawnZoneTeamObject 2 false
9798
battlecode/common/MapInfo/getTrapType 2 false
9899
battlecode/common/MapInfo/getTeamTerritory 2 false
99100
battlecode/common/MapInfo/isSpawnZone 2 false

engine/src/main/battlecode/util/FlatHelpers.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public static byte getWinTypeFromDominationFactor(DominationFactor factor) {
7373
}
7474

7575
public static byte getGlobalUpgradeTypeFromGlobalUpgrade(GlobalUpgrade gu) {
76-
if (gu == GlobalUpgrade.ATTACK)
76+
if (gu == GlobalUpgrade.ATTACK || gu == GlobalUpgrade.ACTION)
7777
return GlobalUpgradeType.ACTION_UPGRADE;
7878
if (gu == GlobalUpgrade.HEALING)
7979
return GlobalUpgradeType.HEALING_UPGRADE;

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,9 +323,10 @@ public MapLocation[] senseBroadcastFlagLocations() {
323323
public boolean senseLegalStartingFlagPlacement(MapLocation loc) throws GameActionException{
324324
assertCanSenseLocation(loc);
325325
if(!gameWorld.isPassable(loc)) return false;
326+
boolean hasFlag = robot.hasFlag();
326327
boolean valid = true;
327328
for(Flag x : gameWorld.getAllFlags()) {
328-
if(x.getId() != robot.getFlag().getId() && x.getTeam() == robot.getTeam() &&
329+
if((!hasFlag || x.getId() != robot.getFlag().getId()) && x.getTeam() == robot.getTeam() &&
329330
x.getLoc().distanceSquaredTo(loc) <= GameConstants.MIN_FLAG_SPACING_SQUARED && !x.isPickedUp()) {
330331
valid = false;
331332
break;
@@ -962,7 +963,7 @@ public void writeSharedArray(int index, int value) throws GameActionException {
962963

963964
private void assertCanBuyGlobal(GlobalUpgrade ug) throws GameActionException{
964965
int i = -1;
965-
if(ug == GlobalUpgrade.ATTACK)
966+
if(ug == GlobalUpgrade.ATTACK || ug == GlobalUpgrade.ACTION)
966967
i = 0;
967968
else if(ug == GlobalUpgrade.CAPTURING)
968969
i = 1;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public void incrementGlobalUpgradePoints(Team team){
115115
*/
116116
public boolean makeGlobalUpgrade(Team team, GlobalUpgrade upgrade){
117117
if(this.globalUpgradePoints[team.ordinal()] > 0){
118-
if (upgrade == GlobalUpgrade.ATTACK && !this.globalUpgrades[team.ordinal()][0]) {
118+
if ((upgrade == GlobalUpgrade.ATTACK || upgrade == GlobalUpgrade.ACTION) && !this.globalUpgrades[team.ordinal()][0]) {
119119
this.globalUpgrades[team.ordinal()][0] = true;
120120
this.globalUpgradePoints[team.ordinal()]--;
121121
return true;

specs/specs.md.html

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
# **Formal specification**
1818

19-
_This is the formal specification of the Battlecode 2024 game._ Current version: *2.0.0*
19+
_This is the formal specification of the Battlecode 2024 game._ Current version: *2.0.1*
2020

2121
**Welcome to Battlecode 2024: Breadwars.**
2222

@@ -141,7 +141,7 @@
141141

142142
The goal of attacking is to retrieve your opponent’s flags and bring them to your side. To retrieve this flag, your robots must first find the opponent's flag.
143143

144-
Robots can sense all flags within vision radius at all times, including flags that are picked up by other robots. Additionally, at the end of the setup phase, dropped enemy flags start broadcasting their approximate locations, which serves as a hint for seeking them out. Robots can sense locations of dropped enemy flags outside of vision radius that are accurate within a radius of **$\sqrt{10}$** cells. Every **100** turns, the broadcast location is updated to a new random location within that radius.
144+
Robots can sense all flags within vision radius at all times, including flags that are picked up by other robots. Additionally, at the end of the setup phase, dropped enemy flags start broadcasting their approximate locations, which serves as a hint for seeking them out. Robots can sense locations of dropped enemy flags outside of vision radius that are accurate within a radius of **$\sqrt{100}$** cells. Every **100** turns, the broadcast location is updated to a new random location within that radius.
145145

146146
Robots can pick up and drop flags as described in the actions section. While holding a flag, robots cannot perform any actions besides movement, and robots may carry only one flag at a time. If your robot enters a friendly spawn zone while carrying an enemy flag, your team captures the flag and it is permanently removed from the game. Flags cannot be captured by being dropped into the spawn zone.
147147

@@ -286,6 +286,13 @@
286286

287287
# **Appendix: Changelog**
288288

289+
- Version 2.0.1 (January 17, 2024)
290+
- Engine fixes
291+
- getSpawnZoneTeam() will still return int for backwards compatability
292+
- getSpawnZoneTeamObject() will return a Team object
293+
- 'ACTION' global upgrade retained for backwards compatability, will function as 'ATTACK'
294+
- Fixed null pointer exception with senseLegalStartingFlagPlacement
295+
289296
- Version 2.0.0 (January 17, 2024)
290297
- Balance changes
291298
- Decreased attack level XP requirements
@@ -297,8 +304,8 @@
297304
- Explosive trap nerf
298305
- Radius when triggered by walking on trap $\sqrt{13}$ -> $\sqrt{4}$
299306
- Radius when triggered by building $\sqrt{9}$ -> $\sqrt{2}$
300-
- Damage when triggered by building 500 -> 200 (fixed bug causing damage to always be 750)
301-
- Stun trap and explosive trap trigger radius 1 -> $\sqrt{2}$
307+
- Damage when triggered by building, digging, or filling 500 -> 200 (fixed bug causing damage to always be 750)
308+
- Stun trap and water trap trigger radius 1 -> $\sqrt{2}$
302309
- Stun trap stun rounds 40 -> 50
303310
- Flag broadcast radius $\sqrt{10}$ -> $\sqrt{100}$
304311
- Global upgrades can now be acquired every 600 rounds instead of 750
@@ -308,6 +315,7 @@
308315
- Engine improvements
309316
- The senseLegalStartingFlagPlacement method no longer checks if the location is adjacent to the robot
310317
- Added getAttackDamage() and getHealAmount() methods
318+
- getSpawnZoneTeam() now returns a Team object
311319

312320
- Version 1.2.5 (January 16, 2024)
313321
- Engine improvements

0 commit comments

Comments
 (0)