mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-04-25 07:32:19 -05:00
16 lines
399 B
TypeScript
16 lines
399 B
TypeScript
import shuffle from "just-shuffle";
|
|
import type { ModeShort } from "../in-game-lists";
|
|
|
|
export function modesOrder(
|
|
type: "EQUAL" | "SZ_EVERY_OTHER",
|
|
modes: ModeShort[]
|
|
): ModeShort[] {
|
|
if (type === "EQUAL") {
|
|
return shuffle(modes);
|
|
}
|
|
|
|
const withoutSZ = shuffle(modes.filter((mode) => mode !== "SZ"));
|
|
|
|
return withoutSZ.flatMap((mode, i) => (i % 2 === 0 ? ["SZ", mode] : [mode]));
|
|
}
|