Завершить инженерный кандидат Stage 5

This commit is contained in:
2026-08-19 02:04:45 +03:00
parent b840684ef3
commit cde886ca96
45 changed files with 3236 additions and 98 deletions
@@ -0,0 +1,24 @@
package com.projectsacrifice.game;
import java.util.Arrays;
/** Small deterministic variant chooser with independent no-repeat history per cue. */
public final class AudioCueSequencer {
private final int[] previous = new int[AudioCue.values().length];
private long state;
public AudioCueSequencer(long seed) {
Arrays.fill(previous, -1);
state = seed == 0L ? 0x6d2b79f5L : seed;
}
public int nextVariant(AudioCue cue) {
if (cue == null || cue.variants() <= 1) return 0;
state = state * 6364136223846793005L + 1442695040888963407L;
int candidate = (int) Math.floorMod(state >>> 24, cue.variants());
int index = cue.ordinal();
if (candidate == previous[index]) candidate = (candidate + 1) % cue.variants();
previous[index] = candidate;
return candidate;
}
}