Add pure correction and pedagogy logic with full test coverage

scripts/correction/: AnswerValidator (multiple choice, sentence
correction via tap-the-faulty-word + retype) and DictationAnalyzer
build the CorrectionResult structure from cahier des charges §6.
Dictation analysis aligns words with WordAligner (Wagner-Fischer edit
distance) before any character comparison, so an omitted or added
word doesn't cascade into false errors on every following word.
TextNormalizer handles non-breaking spaces, typographic apostrophes,
and decomposed-vs-composed French accented characters via an
explicit table (GDScript has no built-in NFC/NFD normalization).
Error classification follows the data annotations only (rule_id
present -> grammatical, absent -> unclassified), never a runtime
linguistic guess.

scripts/pedagogy/: DifficultyManager (per-skill difficulty from
recent results), AttemptFlow (3-attempt graduated aid: hint, then
explanation, then reveal, matching exercise-lifecycle.md's second
gap), and ReviewScheduler (the five mastery states from §9, with
session-counted spaced review intervals [1, 3, 6, 12] rather than
wall-clock dates, since a family device's clock isn't trustworthy).

All of it is pure: no scene tree, no clock or RNG read directly,
every effectful input (session number, attempt outcome) is a
parameter. 65 headless tests across both layers, including the
word-omission-doesn't-cascade regression and the full
decouverte -> acquise -> a_reviser -> acquise path.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Denis Defolie
2026-10-11 17:03:14 +02:00
parent d057c8ee77
commit 2fe455f5d1
36 changed files with 1111 additions and 28 deletions
+99
View File
@@ -0,0 +1,99 @@
class_name AnswerValidator
extends RefCounted
## Valide une reponse de choix multiple ou de correction de phrase et produit
## la structure de correction du §6 (voir CorrectionResult). Code pur : aucune
## dependance a l'arbre de scenes, aucune horloge, aucun hasard.
static func validate_multiple_choice(
exercise: Dictionary, selected_answer: int
) -> CorrectionResult:
var correct_answer: int = exercise["correct_answer"]
if selected_answer == correct_answer:
return CorrectionResult.correct(exercise["explanation"])
var answers: Array = exercise["answers"]
var found := ""
if selected_answer >= 0 and selected_answer < answers.size():
found = answers[selected_answer]
var expected: String = answers[correct_answer]
var error := {
"position": 0,
"error_type": "grammatical",
"rule_id": exercise["rule_id"],
"found": found,
"expected": expected,
}
return CorrectionResult.incorrect(
[error], exercise["explanation"], exercise["hint"], [expected]
)
## selected_indices : index des tokens que l'enfant a touches comme fautifs.
## corrections : correction saisie pour chaque token touche (cle = index du
## token, valeur = texte saisi).
static func validate_sentence_correction(
exercise: Dictionary, selected_indices: Array[int], corrections: Dictionary
) -> CorrectionResult:
var tokens: Array = exercise["tokens"]
var errors: Array[Dictionary] = []
for i in tokens.size():
var token: Dictionary = tokens[i]
var is_faulty: bool = token.get("correct", true) == false
var was_selected: bool = selected_indices.has(i)
if is_faulty and not was_selected:
errors.append(_missed_error(i, token, exercise))
elif is_faulty and was_selected:
var submitted: String = corrections.get(i, "")
if submitted != token["expected"]:
errors.append(_wrong_correction_error(i, submitted, token, exercise))
elif not is_faulty and was_selected:
errors.append(_false_positive_error(i, token, exercise))
if errors.is_empty():
return CorrectionResult.correct(exercise["explanation"])
var remediation: Array[String] = []
for token: Dictionary in tokens:
if token.get("correct", true) == false:
remediation.append(token["expected"])
return CorrectionResult.incorrect(
errors, exercise["explanation"], exercise["hint"], remediation
)
static func _missed_error(index: int, token: Dictionary, exercise: Dictionary) -> Dictionary:
return {
"position": index,
"error_type": "grammatical",
"rule_id": token.get("rule_id", exercise["rule_id"]),
"found": token["text"],
"expected": token["expected"],
}
static func _wrong_correction_error(
index: int, submitted: String, token: Dictionary, exercise: Dictionary
) -> Dictionary:
return {
"position": index,
"error_type": "grammatical",
"rule_id": token.get("rule_id", exercise["rule_id"]),
"found": submitted,
"expected": token["expected"],
}
static func _false_positive_error(
index: int, token: Dictionary, exercise: Dictionary
) -> Dictionary:
return {
"position": index,
"error_type": "unclassified",
"rule_id": exercise["rule_id"],
"found": token["text"],
"expected": token["text"],
}
@@ -0,0 +1 @@
uid://cxrvun2qowvp8
+35
View File
@@ -0,0 +1,35 @@
class_name CorrectionResult
extends RefCounted
## Structure de correction retournee par answer_validator et dictation_analyzer
## (cahier des charges §6, docs/specs/decisions.md point 4). Chaque entree de
## `errors` : {"position": int, "error_type": String ("lexical" | "grammatical" |
## "unclassified" | "capitalization"), "rule_id": String, "found": String,
## "expected": String}.
var is_correct: bool
var errors: Array[Dictionary]
var explanation: String
var hint: String
var remediation: Array[String]
static func correct(explanation: String) -> CorrectionResult:
var result := CorrectionResult.new()
result.is_correct = true
result.errors = []
result.explanation = explanation
result.hint = ""
result.remediation = []
return result
static func incorrect(
errors: Array[Dictionary], explanation: String, hint: String, remediation: Array[String]
) -> CorrectionResult:
var result := CorrectionResult.new()
result.is_correct = false
result.errors = errors
result.explanation = explanation
result.hint = hint
result.remediation = remediation
return result
@@ -0,0 +1 @@
uid://38ngt760408y
+128
View File
@@ -0,0 +1,128 @@
class_name DictationAnalyzer
extends RefCounted
## Analyse la production ecrite d'un enfant pour une dictee : alignement mot a
## mot (WordAligner) avant comparaison, normalisation (TextNormalizer), puis
## classification de chaque erreur via les annotations de la donnee cible
## (dictation["words"]). Sans annotation (pas de rule_id), l'erreur reste non
## classee (voir "Points durs" du prompt de lancement). Code pur, sans horloge
## ni hasard. L'explication complete (texte de la regle) est composee par la
## couche d'affichage a partir des rule_id retournes, pas ici.
static func analyze(dictation: Dictionary, submitted_text: String) -> CorrectionResult:
var normalized_submitted := TextNormalizer.normalize(submitted_text)
var normalized_target := TextNormalizer.normalize(dictation["target_text"])
if _matches_target_or_variant(dictation, normalized_submitted, normalized_target):
return CorrectionResult.correct(_build_explanation(0))
var target_words := TextNormalizer.split_words(normalized_target)
var submitted_words := TextNormalizer.split_words(normalized_submitted)
var words_meta: Array = dictation["words"]
# L'alignement se fait insensible a la casse : une majuscule manquante est
# une erreur de capitalisation a part, pas un mot substitue (voir
# docs/specs/decisions.md point 6).
var target_words_for_align := _to_lower_all(target_words)
var submitted_words_for_align := _to_lower_all(submitted_words)
var ops := WordAligner.align(target_words_for_align, submitted_words_for_align)
var errors: Array[Dictionary] = []
for op: Dictionary in ops:
match op["op"]:
"match":
var capital_error: Variant = _check_capitalization(
words_meta, op["target_index"], submitted_words[op["submitted_index"]]
)
if capital_error != null:
errors.append(capital_error)
"substitute":
(
errors
. append(
_classify_error(
words_meta,
op["target_index"],
submitted_words[op["submitted_index"]],
)
)
)
"delete":
errors.append(_classify_error(words_meta, op["target_index"], ""))
"insert":
(
errors
. append(
{
"position": target_words.size(),
"error_type": "unclassified",
"rule_id": "",
"found": submitted_words[op["submitted_index"]],
"expected": "",
}
)
)
if errors.is_empty():
return CorrectionResult.correct(_build_explanation(0))
return CorrectionResult.incorrect(
errors, _build_explanation(errors.size()), "", [dictation["target_text"]]
)
static func _matches_target_or_variant(
dictation: Dictionary, normalized_submitted: String, normalized_target: String
) -> bool:
if normalized_submitted == normalized_target:
return true
for variant: String in dictation.get("accepted_variants", []):
if normalized_submitted == TextNormalizer.normalize(variant):
return true
return false
static func _classify_error(words_meta: Array, target_index: int, found: String) -> Dictionary:
var meta: Dictionary = words_meta[target_index] if target_index < words_meta.size() else {}
var expected: String = meta.get("text", "")
var rule_id: String = meta.get("rule_id", "")
return {
"position": target_index,
"error_type": "grammatical" if not rule_id.is_empty() else "unclassified",
"rule_id": rule_id,
"found": found,
"expected": expected,
}
static func _check_capitalization(
words_meta: Array, target_index: int, submitted_word: String
) -> Variant:
if target_index >= words_meta.size() or submitted_word.is_empty():
return null
var meta: Dictionary = words_meta[target_index]
if not meta.get("expects_capital", false):
return null
var first_letter := submitted_word.substr(0, 1)
if first_letter == first_letter.to_upper():
return null
return {
"position": target_index,
"error_type": "capitalization",
"rule_id": meta.get("rule_id", ""),
"found": submitted_word,
"expected": meta.get("text", submitted_word),
}
static func _to_lower_all(words: Array[String]) -> Array[String]:
var result: Array[String] = []
for word in words:
result.append(word.to_lower())
return result
static func _build_explanation(error_count: int) -> String:
if error_count == 0:
return "Dictee correcte."
return "Dictee corrigee : %d erreur(s) a revoir." % error_count
@@ -0,0 +1 @@
uid://cj3x15p8r3rmj
+67
View File
@@ -0,0 +1,67 @@
class_name TextNormalizer
extends RefCounted
## Normalisation de texte avant comparaison dans les dictees : espaces (dont
## insecables), apostrophes typographiques, et sequences Unicode decomposees
## des caracteres francais ramenees a leur forme composee. GDScript n'expose
## pas de normalisation NFC/NFD native : table explicite ici, comme prevu par
## les "Points durs" du prompt de lancement.
const NBSP := " "
const NARROW_NBSP := " "
const TYPOGRAPHIC_APOSTROPHE := "’"
## Sequences decomposees (lettre de base + marque combinante) -> caractere
## compose. Couvre les caracteres francais courants : accents, cedille, trema.
const DECOMPOSED_TO_COMPOSED := {
"é": "é",
"è": "è",
"ê": "ê",
"ë": "ë",
"É": "É",
"È": "È",
"Ê": "Ê",
"Ë": "Ë",
"à": "à",
"â": "â",
"À": "À",
"Â": "Â",
"ù": "ù",
"û": "û",
"ü": "ü",
"Ù": "Ù",
"Û": "Û",
"Ü": "Ü",
"î": "î",
"ï": "ï",
"Î": "Î",
"Ï": "Ï",
"ô": "ô",
"ö": "ö",
"Ô": "Ô",
"Ö": "Ö",
"ç": "ç",
"Ç": "Ç",
}
static func normalize(text: String) -> String:
var result := text
result = result.replace(NBSP, " ")
result = result.replace(NARROW_NBSP, " ")
result = result.replace(TYPOGRAPHIC_APOSTROPHE, "'")
for decomposed: String in DECOMPOSED_TO_COMPOSED:
result = result.replace(decomposed, DECOMPOSED_TO_COMPOSED[decomposed])
while result.find(" ") != -1:
result = result.replace(" ", " ")
return result.strip_edges()
static func split_words(text: String) -> Array[String]:
var normalized := normalize(text)
var words: Array[String] = []
if normalized.is_empty():
return words
var parts: PackedStringArray = normalized.split(" ", false)
for part in parts:
words.append(part)
return words
@@ -0,0 +1 @@
uid://07glvxpdv5ml
+55
View File
@@ -0,0 +1,55 @@
class_name WordAligner
extends RefCounted
## Alignement mot a mot entre le texte cible et la production de l'enfant
## (distance d'edition, algorithme de Wagner-Fischer), avant toute comparaison
## caractere par caractere : sans cela, un mot omis ou ajoute decale tous les
## mots suivants et les transforme en erreurs (voir "Points durs" du prompt de
## lancement).
## Chaque operation : {"op": "match" | "substitute" | "delete" | "insert",
## "target_index": int (-1 si insert), "submitted_index": int (-1 si delete)}.
## "delete" = mot du texte cible absent de la production ; "insert" = mot
## ajoute par l'enfant, absent du texte cible.
static func align(target_words: Array[String], submitted_words: Array[String]) -> Array[Dictionary]:
var n := target_words.size()
var m := submitted_words.size()
var cost: Array = []
for i in n + 1:
var row: Array[int] = []
for _j in m + 1:
row.append(0)
cost.append(row)
for i in n + 1:
cost[i][0] = i
for j in m + 1:
cost[0][j] = j
for i in range(1, n + 1):
for j in range(1, m + 1):
if target_words[i - 1] == submitted_words[j - 1]:
cost[i][j] = cost[i - 1][j - 1]
else:
cost[i][j] = 1 + mini(mini(cost[i - 1][j], cost[i][j - 1]), cost[i - 1][j - 1])
var ops: Array[Dictionary] = []
var i := n
var j := m
while i > 0 or j > 0:
if i > 0 and j > 0 and target_words[i - 1] == submitted_words[j - 1]:
ops.append({"op": "match", "target_index": i - 1, "submitted_index": j - 1})
i -= 1
j -= 1
elif i > 0 and j > 0 and cost[i][j] == cost[i - 1][j - 1] + 1:
ops.append({"op": "substitute", "target_index": i - 1, "submitted_index": j - 1})
i -= 1
j -= 1
elif i > 0 and cost[i][j] == cost[i - 1][j] + 1:
ops.append({"op": "delete", "target_index": i - 1, "submitted_index": -1})
i -= 1
else:
ops.append({"op": "insert", "target_index": -1, "submitted_index": j - 1})
j -= 1
ops.reverse()
return ops
+1
View File
@@ -0,0 +1 @@
uid://dmrmm4pljh4j1
+9 -6
View File
@@ -12,8 +12,10 @@ static func check_multiple_choice(data: Dictionary, path: String) -> Array[Strin
var correct_answer: int = data.get("correct_answer", -1)
if correct_answer < 0 or correct_answer >= answers.size():
errors.append(
"%s : correct_answer (%d) hors des bornes de answers (%d element(s))"
% [path, correct_answer, answers.size()]
(
"%s : correct_answer (%d) hors des bornes de answers (%d element(s))"
% [path, correct_answer, answers.size()]
)
)
return errors
@@ -28,8 +30,7 @@ static func check_sentence_correction(data: Dictionary, path: String) -> Array[S
has_error_token = true
if not token.has("expected"):
errors.append(
"%s.tokens[%d] : token fautif sans correction attendue ('expected')"
% [path, i]
"%s.tokens[%d] : token fautif sans correction attendue ('expected')" % [path, i]
)
if not has_error_token:
errors.append("%s : aucun token fautif, rien a corriger" % path)
@@ -43,7 +44,9 @@ static func check_dictation(data: Dictionary, path: String) -> Array[String]:
var expected_word_count := target_text.split(" ", false).size()
if words.size() != expected_word_count:
errors.append(
"%s : %d mot(s) annote(s) pour %d mot(s) dans target_text"
% [path, words.size(), expected_word_count]
(
"%s : %d mot(s) annote(s) pour %d mot(s) dans target_text"
% [path, words.size(), expected_word_count]
)
)
return errors
+26
View File
@@ -0,0 +1,26 @@
class_name AttemptFlow
extends RefCounted
## Aide graduee sur les tentatives successives d'un meme exercice, tant que la
## reponse est fausse (docs/specs/decisions.md point 7 ; exercise-lifecycle.md,
## ecart 2). Code pur.
enum SupportLevel { HINT, EXPLANATION, REVEAL }
const MAX_ATTEMPTS := 3
## attempt_number : numero de la tentative fautive en cours (1 pour la
## premiere erreur sur cet exercice, 2 pour la deuxieme, etc.).
static func support_level_for_attempt(attempt_number: int) -> SupportLevel:
if attempt_number <= 1:
return SupportLevel.HINT
if attempt_number < MAX_ATTEMPTS:
return SupportLevel.EXPLANATION
return SupportLevel.REVEAL
## Vrai quand la tentative fautive courante doit mettre fin a l'exercice (la
## reponse corrigee est alors montree, sans sanction, et la competence est
## marquee pour une revision avec d'autres exemples).
static func should_end_exercise(attempt_number: int) -> bool:
return attempt_number >= MAX_ATTEMPTS
+1
View File
@@ -0,0 +1 @@
uid://dmkh8crqa1shs
+35
View File
@@ -0,0 +1,35 @@
class_name DifficultyManager
extends RefCounted
## Suggere le niveau de difficulte (1 a 3) du prochain exercice pour une
## competence, a partir de l'historique recent de reussites. Code pur : ne lit
## ni horloge ni hasard, ne modifie aucun etat (ProgressManager est responsable
## du stockage).
const MIN_DIFFICULTY := 1
const MAX_DIFFICULTY := 3
const WINDOW := 3
## recent_results : resultats des tentatives les plus recentes, la derniere en
## dernier. Monte d'un niveau apres WINDOW reussites consecutives ; descend
## d'un niveau apres WINDOW echecs consecutifs ; ne bouge pas sinon. Jamais en
## dehors de [MIN_DIFFICULTY, MAX_DIFFICULTY] : la difficulte evolue sans
## jamais bloquer durablement l'enfant (cahier des charges §2).
static func next_difficulty(current_difficulty: int, recent_results: Array[bool]) -> int:
if recent_results.size() < WINDOW:
return clampi(current_difficulty, MIN_DIFFICULTY, MAX_DIFFICULTY)
var last_window: Array[bool] = recent_results.slice(recent_results.size() - WINDOW)
var all_success := true
var all_failure := true
for result in last_window:
if result:
all_failure = false
else:
all_success = false
if all_success:
return clampi(current_difficulty + 1, MIN_DIFFICULTY, MAX_DIFFICULTY)
if all_failure:
return clampi(current_difficulty - 1, MIN_DIFFICULTY, MAX_DIFFICULTY)
return clampi(current_difficulty, MIN_DIFFICULTY, MAX_DIFFICULTY)
@@ -0,0 +1 @@
uid://dkdkwuxn8iw
+200
View File
@@ -0,0 +1,200 @@
class_name ReviewScheduler
extends RefCounted
## Transitions de maitrise (cahier des charges §9) et planification des
## revisions. Code pur : l'horloge n'intervient jamais ; le numero de seance
## est injecte par l'appelant (ProgressManager), jamais lu directement (voir
## l'invariant d'architecture dans CLAUDE.md). Seuils et paliers detailles dans
## docs/specs/decisions.md, point 5.
const RECENT_WINDOW_SMALL := 5
const RECENT_WINDOW_LARGE := 8
const MIN_SUCCESS_RATE_CONSOLIDATION := 0.6
const MIN_SUCCESS_RATE_ACQUISE := 0.85
const MIN_SUCCESSES_WITHOUT_HINT_CONSOLIDATION := 2
const MIN_HINTLESS_RECENT_SUCCESSES_ACQUISE := 4
const MIN_DISTINCT_SESSIONS_ACQUISE := 3
const MIN_DISTINCT_FORMATS_ACQUISE := 2
const REVIEW_INTERVALS_SESSIONS: Array[int] = [1, 3, 6, 12]
const STATUS_DECOUVERTE := "decouverte"
const STATUS_EN_ACQUISITION := "en_acquisition"
const STATUS_EN_CONSOLIDATION := "en_consolidation"
const STATUS_ACQUISE := "acquise"
const STATUS_A_REVISER := "a_reviser"
static func initial_state() -> Dictionary:
return {
"status": STATUS_DECOUVERTE,
"recent_results": [] as Array[bool],
"recent_hint_used": [] as Array[bool],
"sessions_succeeded": [] as Array[int],
"formats_succeeded": [] as Array[String],
"last_session_practiced": -1,
"review_interval_index": -1,
"next_review_session": -1,
}
## attempt : {"success": bool, "hint_used": bool, "exercise_type": String}.
## Retourne un nouvel etat ; ne modifie jamais `state` en place.
static func record_attempt(
state: Dictionary, attempt: Dictionary, current_session: int
) -> Dictionary:
var previous_status: String = state["status"]
var new_state: Dictionary = state.duplicate(true)
var success: bool = attempt["success"]
var hint_used: bool = attempt["hint_used"]
var exercise_type: String = attempt["exercise_type"]
_push_bounded(new_state["recent_results"], success, RECENT_WINDOW_LARGE)
_push_bounded(new_state["recent_hint_used"], hint_used, RECENT_WINDOW_LARGE)
new_state["last_session_practiced"] = current_session
if success:
if not new_state["sessions_succeeded"].has(current_session):
new_state["sessions_succeeded"].append(current_session)
if not new_state["formats_succeeded"].has(exercise_type):
new_state["formats_succeeded"].append(exercise_type)
var was_due: bool = is_due_for_review(state, current_session)
new_state["status"] = _next_status(new_state, success)
_update_review_schedule(new_state, previous_status, success, was_due, current_session)
return new_state
static func is_due_for_review(state: Dictionary, current_session: int) -> bool:
var next_review: int = state.get("next_review_session", -1)
return next_review != -1 and current_session >= next_review
## A appeler au debut d'une seance pour chaque competence "acquise" avant toute
## nouvelle tentative : un delai de revision atteint sans pratique bascule la
## competence en "a_reviser" (cahier des charges §9, delai de revision).
static func mark_overdue_as_review(state: Dictionary, current_session: int) -> Dictionary:
if state["status"] == STATUS_ACQUISE and is_due_for_review(state, current_session):
var new_state: Dictionary = state.duplicate(true)
new_state["status"] = STATUS_A_REVISER
new_state["review_interval_index"] = -1
new_state["next_review_session"] = -1
return new_state
return state
static func _update_review_schedule(
new_state: Dictionary,
previous_status: String,
success: bool,
was_due: bool,
current_session: int,
) -> void:
var status: String = new_state["status"]
if status == STATUS_A_REVISER:
new_state["review_interval_index"] = -1
new_state["next_review_session"] = -1
return
if status != STATUS_ACQUISE:
return
if previous_status != STATUS_ACQUISE:
# Premiere arrivee en "acquise" (depuis en_consolidation ou a_reviser).
new_state["review_interval_index"] = 0
new_state["next_review_session"] = current_session + REVIEW_INTERVALS_SESSIONS[0]
return
if success and was_due:
var next_index: int = mini(
int(new_state["review_interval_index"]) + 1, REVIEW_INTERVALS_SESSIONS.size() - 1
)
new_state["review_interval_index"] = next_index
new_state["next_review_session"] = current_session + REVIEW_INTERVALS_SESSIONS[next_index]
static func _next_status(state: Dictionary, last_success: bool) -> String:
var current_status: String = state["status"]
if current_status == STATUS_ACQUISE or current_status == STATUS_A_REVISER:
return STATUS_ACQUISE if last_success else STATUS_A_REVISER
if not last_success:
return current_status
if current_status == STATUS_DECOUVERTE:
return STATUS_EN_ACQUISITION
if current_status == STATUS_EN_ACQUISITION:
return STATUS_EN_CONSOLIDATION if _is_ready_for_consolidation(state) else current_status
if current_status == STATUS_EN_CONSOLIDATION:
return STATUS_ACQUISE if _is_ready_for_acquise(state) else current_status
return current_status
static func _is_ready_for_consolidation(state: Dictionary) -> bool:
var recent: Array = _last_n(state["recent_results"], RECENT_WINDOW_SMALL)
var hints: Array = _last_n(state["recent_hint_used"], RECENT_WINDOW_SMALL)
if recent.is_empty():
return false
var successes_without_hint := 0
var success_count := 0
for i in recent.size():
if recent[i]:
success_count += 1
if not hints[i]:
successes_without_hint += 1
var success_rate := float(success_count) / float(recent.size())
return (
successes_without_hint >= MIN_SUCCESSES_WITHOUT_HINT_CONSOLIDATION
and success_rate >= MIN_SUCCESS_RATE_CONSOLIDATION
)
static func _is_ready_for_acquise(state: Dictionary) -> bool:
var recent: Array = _last_n(state["recent_results"], RECENT_WINDOW_LARGE)
var hints: Array = _last_n(state["recent_hint_used"], RECENT_WINDOW_LARGE)
if recent.size() < RECENT_WINDOW_LARGE:
return false
var success_count := 0
for result in recent:
if result:
success_count += 1
var success_rate := float(success_count) / float(recent.size())
if success_rate < MIN_SUCCESS_RATE_ACQUISE:
return false
var hintless_recent_successes := 0
var i := recent.size() - 1
while i >= 0 and hintless_recent_successes < MIN_HINTLESS_RECENT_SUCCESSES_ACQUISE:
if recent[i]:
if hints[i]:
return false
hintless_recent_successes += 1
i -= 1
if hintless_recent_successes < MIN_HINTLESS_RECENT_SUCCESSES_ACQUISE:
return false
if state["sessions_succeeded"].size() < MIN_DISTINCT_SESSIONS_ACQUISE:
return false
if state["formats_succeeded"].size() < MIN_DISTINCT_FORMATS_ACQUISE:
return false
return true
static func _push_bounded(array: Array, value: Variant, max_size: int) -> void:
array.append(value)
while array.size() > max_size:
array.remove_at(0)
static func _last_n(array: Array, n: int) -> Array:
if array.size() <= n:
return array.duplicate()
return array.slice(array.size() - n)
+1
View File
@@ -0,0 +1 @@
uid://cvg4qps443hwe