Never repeat an exercise within a mission; remove near-duplicate sentences (0.5.5)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Denis Defolie
2026-10-12 10:45:31 +02:00
parent f9600cfcf0
commit 409d8b46c5
24 changed files with 408 additions and 104 deletions
+21
View File
@@ -23,3 +23,24 @@ static func pick(
pool = candidates
return pool[rng.randi_range(0, pool.size() - 1)]
## Tire un exercice qui n'a pas encore ete vu pendant la mission : d'abord
## parmi `preferred` (la difficulte visee), puis parmi `all` si tous les
## preferes ont ete vus. Quand tout a ete vu (mission plus longue que le
## contenu disponible), retombe sur `pick` en evitant au moins le dernier vu.
static func pick_unseen(
preferred: Array[Dictionary],
all: Array[Dictionary],
seen_ids: Array[String],
rng: RandomNumberGenerator
) -> Variant:
for source in [preferred, all]:
var pool: Array[Dictionary] = []
for candidate: Dictionary in source:
if not seen_ids.has(candidate["id"]):
pool.append(candidate)
if not pool.is_empty():
return pool[rng.randi_range(0, pool.size() - 1)]
var last := "" if seen_ids.is_empty() else seen_ids[seen_ids.size() - 1]
return pick(preferred, last, rng)