Skip to content

Commit

Permalink
Increase variant tourney frequency
Browse files Browse the repository at this point in the history
1) For the four most popular variants, make hourlys constant.
- Atomic and Antichess tend to be played faster, so give them more
  bullet
- In contrast, chess960 isn't played as fast
- In contrast, zh isn't played as fast, and, additionally, game length is
  hard to predict, so keep zhInc function as is, so to maintain high
  freq of zh tourneys with at least +1 inc.

2) Add back zh elite tourney. The zh team elite tourneys are too hard to find.

3) Adjust tourney UI to group the popular variants in their own lanes.
  • Loading branch information
isaacl committed Aug 30, 2024
1 parent ee5cf80 commit 94514f5
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 54 deletions.
14 changes: 9 additions & 5 deletions modules/tournament/src/main/Schedule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,8 @@ object Schedule:

private val standardIncHours = Set(1, 7, 13, 19)
private def standardInc(s: Schedule) = standardIncHours(s.at.getHour)
private def zhInc(s: Schedule) = s.at.getHour % 2 == 0
private def variantInc(s: Schedule) = s.at.getHour % 4 < 2
private def topOfHour(s: Schedule) = s.at.getMinute < 20

private given Conversion[Int, LimitSeconds] = LimitSeconds(_)
private given Conversion[Int, IncrementSeconds] = IncrementSeconds(_)
Expand All @@ -301,10 +302,13 @@ object Schedule:

(s.freq, s.variant, s.speed) match
// Special cases.
case (Weekend, Crazyhouse, Blitz) => zhEliteTc(s)
case (Hourly, Crazyhouse, SuperBlitz) if zhInc(s) => TC(3 * 60, 1)
case (Hourly, Crazyhouse, Blitz) if zhInc(s) => TC(4 * 60, 2)
case (Hourly, Standard, Blitz) if standardInc(s) => TC(3 * 60, 2)
case (Weekend, Crazyhouse, Blitz) => zhEliteTc(s)

case (Hourly, Standard, Blitz) if standardInc(s) => TC(3 * 60, 2)
case (Hourly, variant, Bullet) if variant.exotic && topOfHour(s) => TC(1 * 60, 1)
case (Hourly, variant, HippoBullet) if variant.exotic => TC(2 * 60, 1)
case (Hourly, variant, SuperBlitz) if variant.exotic && variantInc(s) => TC(3 * 60, 1)
case (Hourly, variant, Blitz) if variant.exotic && variantInc(s) => TC(4 * 60, 2)

case (Shield, variant, Blitz) if variant.exotic => TC(3 * 60, 2)

Expand Down
99 changes: 52 additions & 47 deletions modules/tournament/src/main/TournamentScheduler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,11 @@ Thank you all, you rock!""".some,
Schedule(Weekend, speed, Standard, none, date.pipe(orNextWeek)).plan
}
},
List( // Saturday elite crazyhouse!
at(nextSaturday, 19).map { date =>
Schedule(Weekend, Blitz, Crazyhouse, none, date.pipe(orNextWeek)).plan
}
).flatten,
List( // daily tournaments!
at(today, 16).map { date =>
Schedule(Daily, Bullet, Standard, none, date.pipe(orTomorrow)).plan
Expand Down Expand Up @@ -397,62 +402,62 @@ Thank you all, you rock!""".some,
// Because berserking lowers the player rating
_.map { _.copy(noBerserk = true) }
},
// hourly crazyhouse/chess960/KingOfTheHill tournaments!
(0 to 6).toList.flatMap { hourDelta =>
val when = atTopOfHour(rightNow, hourDelta)
val speed = when.getHour % 7 match
case 0 => HippoBullet
case 1 | 4 => Bullet
case 2 | 5 => SuperBlitz
case 3 | 6 => Blitz
val variant = when.getHour % 3 match
case 0 => Chess960
case 1 => KingOfTheHill
case _ => Crazyhouse
List(Schedule(Hourly, speed, variant, none, when).plan) :::
(speed == Bullet).so:
List(
Schedule(
Hourly,
if when.getHour == 17 then HyperBullet else Bullet,
variant,
none,
when.plusMinutes(30)
).plan
)
// fast popular variant tournaments!
List(Atomic, Antichess).flatMap { variant =>
(-1 to 6).toList.flatMap { hourDelta =>
val when = atTopOfHour(rightNow, hourDelta)
val speed = (when.getHour + variant.id.value) % 7 match
case 0 | 4 => Blitz
case 1 => HippoBullet
case 2 | 5 => Bullet
case 3 | _ => SuperBlitz
List(Schedule(Hourly, speed, variant, none, when).plan) :::
(speed == Bullet).so:
List(
Schedule(
Hourly,
if when.getHour == 18 then HyperBullet else Bullet,
variant,
none,
when.plusMinutes(30)
).plan
)
}
},
// hourly atomic/antichess variant tournaments!
(0 to 6).toList.flatMap { hourDelta =>
val when = atTopOfHour(rightNow, hourDelta)
val speed = when.getHour % 7 match
case 0 | 4 => Blitz
case 1 => HippoBullet
case 2 | 5 => Bullet
case 3 | 6 => SuperBlitz
val variant = if when.getHour % 2 == 0 then Atomic else Antichess
List(Schedule(Hourly, speed, variant, none, when).plan) :::
(speed == Bullet).so:
List(
Schedule(
Hourly,
if when.getHour == 18 then HyperBullet else Bullet,
variant,
none,
when.plusMinutes(30)
).plan
)
// slower popular variant tournaments!
List(Crazyhouse, Chess960).flatMap { variant =>
(-1 to 6).toList.flatMap { hourDelta =>
val when = atTopOfHour(rightNow, hourDelta)
val speed = (when.getHour + variant.id.value) % 7 match
case 0 | 2 | 4 => Blitz
case 1 => HippoBullet
case 3 | 5 => SuperBlitz
case _ => Bullet
List(Schedule(Hourly, speed, variant, none, when).plan) :::
(speed == Bullet).so:
List(
Schedule(
Hourly,
Bullet,
variant,
none,
when.plusMinutes(30)
).plan
)
}
},
// hourly threecheck/horde/racing variant tournaments!
(0 to 6).toList.flatMap { hourDelta =>
// hourly exotic variant tournaments!
(-1 to 6).toList.flatMap { hourDelta =>
val when = atTopOfHour(rightNow, hourDelta)
val speed = when.getHour % 7 match
case 0 | 4 => SuperBlitz
case 1 | 5 => Blitz
case 2 => HippoBullet
case 3 | 6 => Bullet
val variant = when.getHour % 3 match
case 3 | _ => Bullet
val variant = when.getHour % 4 match
case 0 => ThreeCheck
case 1 => Horde
case 2 => KingOfTheHill
case _ => RacingKings
List(Schedule(Hourly, speed, variant, none, when).plan) :::
(speed == Bullet).so:
Expand Down
1 change: 1 addition & 0 deletions modules/tournament/src/test/SchedulerTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ class SchedulerTest extends munit.FunSuite:
)
test("evening"):
assertEquals(
schedulesAt(instantOf(2023, 3, 31, 21, 58)).mkString("\n"),
schedulesAt(instantOf(2023, 3, 31, 21, 58)).mkString("\n"),
List(
"""Unique standard rapid (10+0) Conditions() 2023-06-20T12:00:00Z""",
Expand Down
10 changes: 8 additions & 2 deletions ui/tournament/src/view/scheduleView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,17 @@ function leftPos(time: number) {
return (scale * (rounded - startTime)) / 1000 / 60;
}

const lanedVariants: VariantKey[] = ['crazyhouse', 'chess960', 'atomic', 'antichess'];

function laneGrouper(t: Tournament): number {
if (t.schedule && t.schedule.freq === 'unique') {
return -1;
} else if (t.variant.key !== 'standard') {
return 99;
if (lanedVariants.includes(t.variant.key)) {
return lanedVariants.indexOf(t.variant.key) + 90;
} else {
return 99;
}
} else if (t.schedule && t.hasMaxRating) {
return 50 + parseInt(t.fullName.slice(1, 5)) / 10000;
} else if (t.schedule && t.schedule.speed === 'superBlitz') {
Expand All @@ -64,7 +70,7 @@ function group(arr: Tournament[], grouper: (t: Tournament) => number): Lane[] {
let g;
arr.forEach(e => {
g = grouper(e);
if (groups[g]) groups[g]?.push(e);
if (groups[g]) groups[g]!.push(e);
else groups[g] = [e];
});
return Object.keys(groups)
Expand Down

0 comments on commit 94514f5

Please sign in to comment.