Skip to content

Commit e9ccb54

Browse files
author
Bytekeeper
committed
Doku + Test.
1 parent 16478fc commit e9ccb54

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

src/main/java/org/bk/ass/sim/Simulator.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -299,11 +299,15 @@ public boolean simUnit(
299299
*/
300300
public interface Behavior {
301301

302+
/**
303+
* Simulate the given agent. Returns true if the agent was active (including waiting),
304+
* false if the agent won't be able to do anything anymore.
305+
*/
302306
boolean simUnit(
303-
int frameSkip,
304-
Agent agent,
305-
UnorderedCollection<Agent> allies,
306-
UnorderedCollection<Agent> enemies);
307+
int frameSkip,
308+
Agent agent,
309+
UnorderedCollection<Agent> allies,
310+
UnorderedCollection<Agent> enemies);
307311
}
308312

309313
public static class IntEvaluation {

src/test/java/org/bk/ass/sim/EvaluatorTest.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,4 +353,16 @@ void vsNothingIsFreeWin() {
353353
// THEN
354354
assertThat(result).isGreaterThan(0.9);
355355
}
356+
357+
@Test
358+
void vsHatcheryIsFreeWin() {
359+
List<Agent> a = Collections.singletonList(factory.of(UnitType.Zerg_Zergling));
360+
List<Agent> b = Collections.singletonList(factory.of(UnitType.Zerg_Hatchery));
361+
362+
// WHEN
363+
double result = evaluator.evaluate(a, b);
364+
365+
// THEN
366+
assertThat(result).isGreaterThan(0.9);
367+
}
356368
}

0 commit comments

Comments
 (0)