Skip to content

Commit 277a3dc

Browse files
Including getScore in Creature
1 parent d5b412a commit 277a3dc

6 files changed

Lines changed: 28 additions & 24 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ Proxy for accessing the ws3d Virtual Environment directly from Java, without req
1919
```
2020
dependencies {
2121
...
22-
implementation 'com.github.CST-Group:WS3DProxy:0.0.3'
22+
implementation 'com.github.CST-Group:WS3DProxy:0.0.4'
2323
}
2424
```

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ java {
1010
}
1111

1212

13-
version = '0.0.3'
13+
version = '0.0.4'
1414

1515
repositories {
1616
mavenCentral()

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#Thu Jan 23 12:51:32 BRT 2020
2-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip
2+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-all.zip
33
distributionBase=GRADLE_USER_HOME
44
distributionPath=wrapper/dists
55
zipStorePath=wrapper/dists

src/main/java/ws3dproxy/model/Bag.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ public class Bag {
4141
public Bag(int numFood, int numCrystals, int numPerishableFood, int numNonPerishableFood, List<Integer> crystals) {
4242

4343
//Initialization with all possible crystal types RED, GREEN, BLUE, YELLOW, MAGENTA, WHITE:
44-
crystalsPerType.put(Constants.colorRED, new Integer(0));
45-
crystalsPerType.put(Constants.colorGREEN, new Integer(0));
46-
crystalsPerType.put(Constants.colorBLUE, new Integer(0));
47-
crystalsPerType.put(Constants.colorYELLOW, new Integer(0));
48-
crystalsPerType.put(Constants.colorMAGENTA, new Integer(0));
49-
crystalsPerType.put(Constants.colorWHITE, new Integer(0));
44+
crystalsPerType.put(Constants.colorRED, Integer.valueOf(0));
45+
crystalsPerType.put(Constants.colorGREEN, Integer.valueOf(0));
46+
crystalsPerType.put(Constants.colorBLUE, Integer.valueOf(0));
47+
crystalsPerType.put(Constants.colorYELLOW, Integer.valueOf(0));
48+
crystalsPerType.put(Constants.colorMAGENTA, Integer.valueOf(0));
49+
crystalsPerType.put(Constants.colorWHITE, Integer.valueOf(0));
5050

5151
supportedCrystalTypes.add(Constants.colorRED);
5252
supportedCrystalTypes.add(Constants.colorGREEN);

src/main/java/ws3dproxy/model/Creature.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,10 @@ public synchronized void setWorldMap(WorldMap worldMap) {
425425
this.worldMap = worldMap;
426426
}
427427

428+
public synchronized double getScore() {
429+
return this.s.score;
430+
}
431+
428432
public synchronized double getSpeed() {
429433
return this.a.speed;
430434
}

src/main/java/ws3dproxy/model/SelfAttributes.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -88,24 +88,24 @@ private void updateMap(String indexID, String name, String colorName, Actuator
8888
infoMap.put(Constants.TOKEN_NAME_ID, name);
8989
infoMap.put(Constants.TOKEN_INDEX, indexID);
9090
infoMap.put(Constants.TOKEN_COLOR, colorName);
91-
infoMap.put(Constants.TOKEN_CREATURE_X, (new Double(s.comX)).toString());//center of mass
92-
infoMap.put(Constants.TOKEN_CREATURE_Y, (new Double(s.comY)).toString());// ""
93-
infoMap.put(Constants.TOKEN_CREATURE_X1, (new Double(s.x1)).toString());
94-
infoMap.put(Constants.TOKEN_CREATURE_Y1, (new Double(s.y1)).toString());
95-
infoMap.put(Constants.TOKEN_CREATURE_X2, (new Double(s.x2)).toString());
96-
infoMap.put(Constants.TOKEN_CREATURE_Y2, (new Double(s.y2)).toString());
97-
infoMap.put(Constants.TOKEN_SPEED, (new Double(act.speed)).toString());
98-
infoMap.put(Constants.TOKEN_WHEEL, (new Double(act.wheel)).toString());
91+
infoMap.put(Constants.TOKEN_CREATURE_X, (Double.valueOf(s.comX)).toString());//center of mass
92+
infoMap.put(Constants.TOKEN_CREATURE_Y, (Double.valueOf(s.comY)).toString());// ""
93+
infoMap.put(Constants.TOKEN_CREATURE_X1, (Double.valueOf(s.x1)).toString());
94+
infoMap.put(Constants.TOKEN_CREATURE_Y1, (Double.valueOf(s.y1)).toString());
95+
infoMap.put(Constants.TOKEN_CREATURE_X2, (Double.valueOf(s.x2)).toString());
96+
infoMap.put(Constants.TOKEN_CREATURE_Y2, (Double.valueOf(s.y2)).toString());
97+
infoMap.put(Constants.TOKEN_SPEED, (Double.valueOf(act.speed)).toString());
98+
infoMap.put(Constants.TOKEN_WHEEL, (Double.valueOf(act.wheel)).toString());
9999
//TODO: include:
100100
// infoMap.put(Constants.TOKEN_WHEEL_R, (new Double(act.vr)).toString());
101101
// infoMap.put(Constants.TOKEN_WHEEL_L, (new Double(act.vl)).toString());
102-
infoMap.put(Constants.TOKEN_CREATURE_PITCH, (new Double(s.pitch)).toString());
103-
infoMap.put(Constants.TOKEN_CREATURE_ENERGY, (new Double(s.fuel)).toString());
104-
infoMap.put(Constants.TOKEN_SEROTONIN, (new Double(s.serotonin)).toString());
105-
infoMap.put(Constants.TOKEN_ENDORPHINE, (new Double(s.endorphine)).toString());
106-
infoMap.put(Constants.TOKEN_SCORE, (new Double(s.score)).toString());
107-
infoMap.put(Constants.TOKEN_HAS_LEAFLET, (new Integer(hasLeaflet)).toString());
108-
infoMap.put(Constants.TOKEN_HAS_COLLIDED, (new Integer(hasCollided)).toString());
102+
infoMap.put(Constants.TOKEN_CREATURE_PITCH, (Double.valueOf(s.pitch)).toString());
103+
infoMap.put(Constants.TOKEN_CREATURE_ENERGY, (Double.valueOf(s.fuel)).toString());
104+
infoMap.put(Constants.TOKEN_SEROTONIN, (Double.valueOf(s.serotonin)).toString());
105+
infoMap.put(Constants.TOKEN_ENDORPHINE, (Double.valueOf(s.endorphine)).toString());
106+
infoMap.put(Constants.TOKEN_SCORE, (Double.valueOf(s.score)).toString());
107+
infoMap.put(Constants.TOKEN_HAS_LEAFLET, (Integer.valueOf(hasLeaflet)).toString());
108+
infoMap.put(Constants.TOKEN_HAS_COLLIDED, (Integer.valueOf(hasCollided)).toString());
109109
infoMap.put(Constants.TOKEN_MY_LEAFLETS, manipulatedLeaflet(myLeaflets));
110110

111111
}

0 commit comments

Comments
 (0)