ucsb-cs156-f22 / team03-f22-6pm-3

0 stars 0 forks source link

Adjust cow health over time (in the Cow Health Update Job) #57

Closed heyyysus closed 1 year ago

heyyysus commented 1 year ago

You will need to iterate over each of the commons, and each of the users, and update the cow health accordingly.

The number of cows here is the total number in each commons.

Here is the formula for adjusting cow health:

  1. Define int carryingCapacity = 100, unless the PR that adds carrying capacity to the commons has already been merged. In that case, let carryingCapacity be commons.getCarryingCapacity();
  2. If commons.getTotalCows() <= carryingCapacity, then increase average cow health (expressed as a percentage) by threshold, but do not let it exceed 100%.
  3. Else (i.e. commons.getTotalCow() > carryingCapacity, then reduce average cow health (expressed as a percentage) by min( (cow - carryingCapacity) * threshold , 100 ). That is, whatever the threshold value is, that value is the percentage by which the averageCowHealth goes down, for each cow over the carrying capacity.

Acceptance Criteria