Configure anger points per Sarka instead of cars per point
continuous-integration/drone/push Build is passing
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -21,6 +21,8 @@ struct Waves
|
||||
struct Rules {'''+band+seats+r'''};
|
||||
int main(){
|
||||
Waves w{};
|
||||
assert(w.AngerPerCar==3);
|
||||
w.Configure(1); // Preserve the timing/retry checks at the densest allowed rate.
|
||||
assert(!w.Due(100,3,true)&&w.NextWave==600100);
|
||||
assert(!w.Due(600099,3,true));
|
||||
assert(w.Due(600100,3,true)&&w.Pending==3&&w.Wave==1);
|
||||
@@ -41,16 +43,26 @@ int main(){
|
||||
Waves configured{};
|
||||
configured.Configure(2);
|
||||
assert(!configured.Due(0,3,true));
|
||||
assert(configured.Due(600000,3,true)&&configured.Target==6);
|
||||
configured.Commit();assert(configured.Pending==5&&configured.Spawned==1);
|
||||
assert(configured.Due(600000,5,true)&&configured.Target==2);
|
||||
configured.Commit();assert(configured.Pending==1&&configured.Spawned==1);
|
||||
configured.Configure(5); // Already sampled wave and deadline stay unchanged.
|
||||
assert(configured.Pending==5&&configured.NextWave==1200000);
|
||||
assert(configured.Due(1200000,30,true)&&configured.Target==30); // Keep the formation cap.
|
||||
assert(configured.Pending==1&&configured.NextWave==1200000);
|
||||
assert(configured.Due(1200000,30,true)&&configured.Target==6);
|
||||
configured.Configure(0);assert(configured.Pending==0&&configured.Target==0);
|
||||
assert(!configured.Due(9999999,30,true)&&configured.Spawned==1); // No waves; retain deployed count.
|
||||
configured.Configure(2);assert(!configured.Due(10000000,3,true));
|
||||
assert(!configured.Due(10599999,3,true)); // Re-enable waits normally, no backlog.
|
||||
assert(configured.Due(10600000,3,true)&&configured.Target==6);
|
||||
assert(configured.Due(10600000,3,true)&&configured.Target==1);
|
||||
// All supported divisors, exact thresholds, remainders and clamped anger.
|
||||
for(int points=1;points<=30;++points){
|
||||
for(int anger=-1;anger<=31;++anger){
|
||||
Waves threshold{};threshold.Configure(points);
|
||||
assert(!threshold.Due(0,anger,true));
|
||||
int expected=std::clamp(anger,0,30)/points;
|
||||
assert(threshold.Due(600000,anger,true)==(expected>0));
|
||||
assert(threshold.Target==expected&&threshold.Pending==expected);
|
||||
}
|
||||
}
|
||||
Array<vector> players{{0,10,0}};
|
||||
assert(!Rules::InBand({999,0,0},players));
|
||||
assert(Rules::InBand({1000,900,0},players)&&Rules::InBand({1250,0,0},players));
|
||||
@@ -61,4 +73,4 @@ int main(){
|
||||
assert(Rules::Seats(1,0,3,4)&&!Rules::Seats(1,1,2,4)&&!Rules::Seats(1,0,4,5));
|
||||
}
|
||||
''')
|
||||
print('PASS: configurable anger multiplier, disable/re-enable, wave cap, staged retries, empty-round reset, no backlog, four seats and nearest-player road distance')
|
||||
print('PASS: anger per car, all thresholds and remainders, disable/re-enable, wave cap, staged retries, empty-round reset, no backlog, four seats and nearest-player road distance')
|
||||
|
||||
Reference in New Issue
Block a user