Skip to content

Commit

Permalink
Reduce playban penalty for aborts
Browse files Browse the repository at this point in the history
Because Abort/NoPlay isn't as bad as staling
on last move.

6 aborts per 15 games will trigger initial playban
and subsequent playbans will trigger more easily.
  • Loading branch information
isaacl committed Nov 19, 2017
1 parent 3dc07ee commit db566a2
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions modules/playban/src/main/model.scala
Expand Up @@ -16,19 +16,22 @@ case class UserRecord(

def nbOutcomes = outcomes.size

def nbBadOutcomes = outcomes.count(_ != Outcome.Good)
def badOutcomeScore: Float = outcomes.collect {
case Outcome.NoPlay | Outcome.Abort => .7f
case o if o != Outcome.Good => 1
} sum

def badOutcomeRatio: Float = if (bans.size < 3) 0.4f else 0.3f

def minBadOutcomes: Int = bans.size match {
case 0 => 4
case 1 | 2 | 3 => 3
case 0 | 1 => 4
case 2 | 3 => 3
case _ => 2
}

def bannable: Option[TempBan] = {
outcomes.lastOption.exists(_ != Outcome.Good) &&
nbBadOutcomes >= (badOutcomeRatio * nbOutcomes atLeast minBadOutcomes)
badOutcomeScore >= (badOutcomeRatio * nbOutcomes atLeast minBadOutcomes)
} option TempBan.make(bans)
}

Expand Down

0 comments on commit db566a2

Please sign in to comment.