feat: ISU 2026/27 und Adult-Kategorien

- SoV 2026/27 (Communication 2786) und Levels 2026/27 (2788)
- 15 Pirouetten- und 5 Sequenz-Features, Windmills, neues ChSp1
- Adult-Kategorien Gold/Silver/Bronze plus Masters/Elite aus dem
  IAFSC-Announcement 2026/27
- Kategorie-Auswahl in der Statusleiste und Kategorie-Validierung
  (Sprunganzahl, erlaubte Sprünge, Level-Caps, Pflichtelemente)
- 60 Adult-Assertions; gesamt 1012 Assertions gruen
- Doku, Findings und Roadmap aktualisiert
This commit is contained in:
torsten 2026-10-31 11:21:18 +01:00
parent 531a057168
commit e4fd74ea6e
25 changed files with 1930 additions and 119 deletions

View file

@ -502,6 +502,12 @@ theme_override_font_sizes/font_size = 15
text = "Abschnitt 1 · 0 Segmente"
vertical_alignment = 1
[node name="AdultCategoryOption" type="OptionButton" parent="Layout/StatusBar/StatusBarContent"]
unique_name_in_owner = true
custom_minimum_size = Vector2(170, 56)
layout_mode = 2
theme_override_font_sizes/font_size = 15
[node name="ValidationButton" type="Button" parent="Layout/StatusBar/StatusBarContent"]
unique_name_in_owner = true
custom_minimum_size = Vector2(120, 56)

View file

@ -10,6 +10,9 @@ const CURRENT_SCHEMA_VERSION := 2
@export var routine_id: String = ""
@export var title: String = ""
@export var skater_name: String = ""
## Adult competition category code (e.g. "gold", "silver", "bronze"). Empty
## means no category-specific validation.
@export var adult_category: String = ""
@export var rink: RinkDimensions = RinkDimensions.new()
@export var sections: Array[RoutineSection] = []

View file

@ -0,0 +1,245 @@
class_name AdultCategoryRules
extends RefCounted
## Adult competition categories and their program limits for one season.
##
## The data comes from the ISU International Adult Figure Skating Competitions
## technical announcement. It covers element counts, allowed jump rotations,
## level caps, required elements and scoring factors. Combination and
## repetition details are stored but validated only in later stages.
const DEFAULT_PATH := "res://src/core/rules/data/isu_adult_2026_27.json"
const SUPPORTED_SCHEMA_VERSION := 1
const ROTATION_NAMES := ["", "single", "double", "triple", "quad"]
class Category extends RefCounted:
var code: String = ""
var name: String = ""
var duration_seconds: int = 0
var duration_tolerance_seconds: int = 10
var max_jump_elements: int = 0
var allowed_rotations: PackedStringArray = PackedStringArray()
var allow_axel: bool = true
var forbidden_jumps: PackedStringArray = PackedStringArray()
var required_axel: bool = false
var max_jump_combinations: int = 0
var max_jump_sequences: int = 0
var max_jumps_per_combination: int = 0
var max_spins: int = 0
var max_step_sequences: int = 0
var max_choreographic_sequences: int = 0
var required_step_sequences: int = 0
var required_choreographic_sequences: int = 0
var requires_choreographic_spin: bool = false
var max_spin_level: int = 0
var max_sequence_level: int = 0
var pcs_factor: float = 0.0
var fall_deduction: float = 0.0
static func jump_rotation(code: String) -> int:
var cleaned := code.strip_edges()
if cleaned.length() < 2:
return 0
var first := cleaned.substr(0, 1)
if not first.is_valid_int():
return 0
var rotation := int(first)
if rotation < 1 or rotation > 4:
return 0
return rotation
static func jump_type(code: String) -> String:
var cleaned := code.strip_edges()
if cleaned.length() < 2:
return ""
return cleaned.substr(1)
func is_jump_allowed(code: String) -> bool:
var cleaned := code.strip_edges()
if cleaned.is_empty() or cleaned.contains("+"):
return true
var rotation := jump_rotation(cleaned)
if rotation <= 0:
return true
if not allowed_rotations.has(ROTATION_NAMES[rotation]):
return false
if jump_type(cleaned) == "A" and not allow_axel:
return false
return not forbidden_jumps.has(cleaned)
func validate() -> PackedStringArray:
var errors := PackedStringArray()
if code.strip_edges().is_empty():
errors.append("code must not be empty")
if name.strip_edges().is_empty():
errors.append("name must not be empty")
if duration_seconds <= 0:
errors.append("duration_seconds must be positive")
for rotation: String in allowed_rotations:
if not ROTATION_NAMES.has(rotation):
errors.append("unknown jump rotation '%s'" % rotation)
if max_spin_level < 0 or max_spin_level > PathSegment.ELEMENT_MAX_LEVEL:
errors.append("max_spin_level is out of range")
if max_sequence_level < 0 or max_sequence_level > PathSegment.ELEMENT_MAX_LEVEL:
errors.append("max_sequence_level is out of range")
return errors
var schema_version: int = 0
var season: String = ""
var source: String = ""
var valid_from: String = ""
var _categories: Array[Category] = []
var _by_code: Dictionary[String, Category] = {}
var _errors: PackedStringArray = PackedStringArray()
static func load_default() -> AdultCategoryRules:
return load_from(DEFAULT_PATH)
static func load_from(path: String) -> AdultCategoryRules:
var rules := AdultCategoryRules.new()
rules._parse_file(path)
return rules
func get_categories() -> Array[Category]:
var copy: Array[Category] = []
copy.assign(_categories)
return copy
func get_category(code: String) -> Category:
return _by_code.get(code.strip_edges().to_lower(), null)
func has_category(code: String) -> bool:
return get_category(code) != null
func get_errors() -> PackedStringArray:
return _errors.duplicate()
func validate() -> PackedStringArray:
var errors := _errors.duplicate()
if schema_version != SUPPORTED_SCHEMA_VERSION:
errors.append(
"unsupported adult-category schema %d (expected %d)"
% [schema_version, SUPPORTED_SCHEMA_VERSION]
)
if season.strip_edges().is_empty():
errors.append("adult-category season must not be empty")
if source.strip_edges().is_empty():
errors.append("adult-category source must not be empty")
if _categories.is_empty():
errors.append("adult-category rules contain no categories")
return errors
func is_valid() -> bool:
return validate().is_empty()
func _parse_file(path: String) -> void:
var file := FileAccess.open(path, FileAccess.READ)
if file == null:
_errors.append("cannot open adult categories '%s'" % path)
return
var json := JSON.new()
var error := json.parse(file.get_as_text())
if error != OK:
_errors.append(
"invalid adult-category JSON at line %d: %s"
% [json.get_error_line(), json.get_error_message()]
)
return
if typeof(json.data) != TYPE_DICTIONARY:
_errors.append("adult-category root must be a JSON object")
return
_parse_root(json.data as Dictionary)
func _parse_root(data: Dictionary) -> void:
schema_version = int(data.get("schema_version", 0))
season = str(data.get("season", "")).strip_edges()
source = str(data.get("source", "")).strip_edges()
valid_from = str(data.get("valid_from", "")).strip_edges()
var entries: Variant = data.get("categories", [])
if typeof(entries) != TYPE_ARRAY:
_errors.append("adult-category 'categories' must be an array")
return
for entry: Variant in entries:
if typeof(entry) != TYPE_DICTIONARY:
_errors.append("adult-category entry must be an object")
continue
var category := _parse_category(entry as Dictionary)
if category == null:
continue
for message: String in category.validate():
_errors.append("%s: %s" % [category.code, message])
var key := category.code.to_lower()
if _by_code.has(key):
_errors.append("duplicate adult category '%s'" % category.code)
continue
_by_code[key] = category
_categories.append(category)
func _parse_category(entry: Dictionary) -> Category:
var category := Category.new()
category.code = str(entry.get("code", "")).strip_edges()
category.name = str(entry.get("name", "")).strip_edges()
category.duration_seconds = int(entry.get("duration_seconds", 0))
category.duration_tolerance_seconds = int(
entry.get("duration_tolerance_seconds", 10)
)
category.max_jump_elements = int(entry.get("max_jump_elements", 0))
category.allowed_rotations = _to_string_array(
entry.get("allowed_rotations", [])
)
category.allow_axel = bool(entry.get("allow_axel", true))
category.forbidden_jumps = _to_string_array(
entry.get("forbidden_jumps", [])
)
category.required_axel = bool(entry.get("required_axel", false))
category.max_jump_combinations = int(
entry.get("max_jump_combinations", 0)
)
category.max_jump_sequences = int(entry.get("max_jump_sequences", 0))
category.max_jumps_per_combination = int(
entry.get("max_jumps_per_combination", 0)
)
category.max_spins = int(entry.get("max_spins", 0))
category.max_step_sequences = int(entry.get("max_step_sequences", 0))
category.max_choreographic_sequences = int(
entry.get("max_choreographic_sequences", 0)
)
category.required_step_sequences = int(
entry.get("required_step_sequences", 0)
)
category.required_choreographic_sequences = int(
entry.get("required_choreographic_sequences", 0)
)
category.requires_choreographic_spin = bool(
entry.get("requires_choreographic_spin", false)
)
category.max_spin_level = int(entry.get("max_spin_level", 0))
category.max_sequence_level = int(entry.get("max_sequence_level", 0))
category.pcs_factor = float(entry.get("pcs_factor", 0.0))
category.fall_deduction = float(entry.get("fall_deduction", 0.0))
return category
static func _to_string_array(values: Variant) -> PackedStringArray:
var result := PackedStringArray()
if typeof(values) != TYPE_ARRAY:
return result
for value: Variant in values as Array:
var cleaned := str(value).strip_edges()
if not cleaned.is_empty():
result.append(cleaned)
return result

View file

@ -0,0 +1 @@
uid://rnmbiv5fe76n

View file

@ -0,0 +1,128 @@
{
"schema_version": 1,
"season": "2026/27",
"source": "ISU International Adult Figure Skating Competitions 2026/27 – Technical Announcement",
"valid_from": "2026-07-01",
"categories": [
{
"code": "bronze",
"name": "Bronze",
"duration_seconds": 100,
"duration_tolerance_seconds": 10,
"max_jump_elements": 4,
"allowed_rotations": ["single"],
"allow_axel": false,
"forbidden_jumps": [],
"required_axel": false,
"max_jump_combinations": 1,
"max_jump_sequences": 0,
"max_jumps_per_combination": 2,
"max_spins": 2,
"max_step_sequences": 0,
"max_choreographic_sequences": 1,
"required_step_sequences": 0,
"required_choreographic_sequences": 1,
"requires_choreographic_spin": false,
"max_spin_level": 1,
"max_sequence_level": 1,
"pcs_factor": 2.0,
"fall_deduction": 0.5
},
{
"code": "silver",
"name": "Silver",
"duration_seconds": 120,
"duration_tolerance_seconds": 10,
"max_jump_elements": 4,
"allowed_rotations": ["single"],
"allow_axel": true,
"forbidden_jumps": [],
"required_axel": false,
"max_jump_combinations": 2,
"max_jump_sequences": 1,
"max_jumps_per_combination": 3,
"max_spins": 2,
"max_step_sequences": 0,
"max_choreographic_sequences": 1,
"required_step_sequences": 0,
"required_choreographic_sequences": 1,
"requires_choreographic_spin": false,
"max_spin_level": 2,
"max_sequence_level": 2,
"pcs_factor": 2.0,
"fall_deduction": 0.5
},
{
"code": "gold",
"name": "Gold",
"duration_seconds": 170,
"duration_tolerance_seconds": 10,
"max_jump_elements": 5,
"allowed_rotations": ["single", "double"],
"allow_axel": true,
"forbidden_jumps": ["2F", "2Lz", "2A"],
"required_axel": false,
"max_jump_combinations": 2,
"max_jump_sequences": 1,
"max_jumps_per_combination": 3,
"max_spins": 3,
"max_step_sequences": 1,
"max_choreographic_sequences": 0,
"required_step_sequences": 1,
"required_choreographic_sequences": 0,
"requires_choreographic_spin": true,
"max_spin_level": 3,
"max_sequence_level": 2,
"pcs_factor": 2.67,
"fall_deduction": 1.0
},
{
"code": "masters",
"name": "Masters",
"duration_seconds": 180,
"duration_tolerance_seconds": 10,
"max_jump_elements": 5,
"allowed_rotations": ["single", "double"],
"allow_axel": true,
"forbidden_jumps": [],
"required_axel": true,
"max_jump_combinations": 2,
"max_jump_sequences": 1,
"max_jumps_per_combination": 3,
"max_spins": 3,
"max_step_sequences": 1,
"max_choreographic_sequences": 0,
"required_step_sequences": 1,
"required_choreographic_sequences": 0,
"requires_choreographic_spin": true,
"max_spin_level": 4,
"max_sequence_level": 4,
"pcs_factor": 2.67,
"fall_deduction": 1.0
},
{
"code": "masters_elite",
"name": "Masters Elite",
"duration_seconds": 180,
"duration_tolerance_seconds": 10,
"max_jump_elements": 5,
"allowed_rotations": ["single", "double", "triple"],
"allow_axel": true,
"forbidden_jumps": [],
"required_axel": true,
"max_jump_combinations": 2,
"max_jump_sequences": 1,
"max_jumps_per_combination": 3,
"max_spins": 3,
"max_step_sequences": 1,
"max_choreographic_sequences": 0,
"required_step_sequences": 1,
"required_choreographic_sequences": 0,
"requires_choreographic_spin": true,
"max_spin_level": 4,
"max_sequence_level": 4,
"pcs_factor": 2.67,
"fall_deduction": 1.0
}
]
}

View file

@ -0,0 +1,192 @@
{
"schema_version": 1,
"season": "2026/27",
"discipline": "Single Skating",
"valid_from": "2026-06-01",
"source": "ISU Communication No. 2788, Levels of Difficulty and Guidelines for marking Grade of Execution and Program Components, Season 2026/27",
"levels": [
{
"level": 1,
"min_features": 1
},
{
"level": 2,
"min_features": 2
},
{
"level": 3,
"min_features": 3
},
{
"level": 4,
"min_features": 4
}
],
"fixed_levels": {
"ChSq": 1,
"ChSp": 1
},
"types": {
"spin": {
"required_features": [],
"level4_requires_any": [
"difficult_exit",
"change_of_edge",
"both_directions",
"increase_speed",
"difficult_flying_entry",
"windmills"
],
"features": [
{
"code": "difficult_variation",
"name": "Schwierige Variation",
"description": "Schwierige Variation einer Grundposition; höchstens zwei zählen pro Pirouette.",
"max_per_element": 2,
"once_per_program": false
},
{
"code": "change_foot_jump",
"name": "Fußwechsel per Sprung",
"description": "Fußwechsel mit einem Sprung ausgeführt.",
"max_per_element": 1,
"once_per_program": true
},
{
"code": "jump_in_spin",
"name": "Sprung in der Pirouette",
"description": "Sprung innerhalb der Pirouette ohne Fußwechsel.",
"max_per_element": 1,
"once_per_program": true
},
{
"code": "difficult_position_change",
"name": "Schwieriger Positionswechsel",
"description": "Schwieriger Positionswechsel auf demselben Fuß.",
"max_per_element": 1,
"once_per_program": true
},
{
"code": "difficult_entrance",
"name": "Schwieriger Eingang",
"description": "Schwieriger Eingang in die Pirouette.",
"max_per_element": 1,
"once_per_program": true
},
{
"code": "difficult_exit",
"name": "Schwieriger Ausgang",
"description": "Schwieriger Ausgang aus der Pirouette.",
"max_per_element": 1,
"once_per_program": true
},
{
"code": "change_of_edge",
"name": "Klare Kantenänderung",
"description": "Klare Kantenänderung in Sit, Camel, Layback, Biellmann oder schwieriger Upright-Variation.",
"max_per_element": 1,
"once_per_program": true
},
{
"code": "both_directions",
"name": "Beide Richtungen",
"description": "Beide Drehrichtungen unmittelbar nacheinander in Sit, Camel, Layback oder schwieriger Upright-Variation.",
"max_per_element": 1,
"once_per_program": true
},
{
"code": "increase_speed",
"name": "Klare Temposteigerung",
"description": "Klare Temposteigerung in Camel, Sit, Layback, Biellmann oder schwieriger Upright-Variation (nicht Crossfoot).",
"max_per_element": 1,
"once_per_program": true
},
{
"code": "eight_revolutions",
"name": "8 Umdrehungen ohne Wechsel",
"description": "Mindestens 8 Umdrehungen ohne Wechsel von Position, Variation, Fuß oder Kante.",
"max_per_element": 1,
"once_per_program": true
},
{
"code": "difficult_flying_entry",
"name": "Schwieriger Flug-Eingang",
"description": "Schwierige Variation des fliegenden Eingangs bei Flugpirouetten.",
"max_per_element": 1,
"once_per_program": true
},
{
"code": "difficult_blade",
"name": "Schwieriges Klingenmerkmal",
"description": "Schwieriges Klingenmerkmal in Camel, Sit, Layback, Biellmann oder schwieriger Upright-Variation.",
"max_per_element": 1,
"once_per_program": true
},
{
"code": "windmills",
"name": "Windmills",
"description": "Windmills, dreimal hintereinander; jede Bewegung nahe am Spagat (mind. 135°). Zählt einmal pro Programm.",
"max_per_element": 1,
"once_per_program": true
},
{
"code": "layback_change",
"name": "Layback-Positionswechsel",
"description": "Layback: klarer Wechsel rückwärts-seitwärts oder umgekehrt, mindestens 2 Umdrehungen je Position.",
"max_per_element": 1,
"once_per_program": true
},
{
"code": "layback_biellmann",
"name": "Biellmann nach Layback",
"description": "Layback: Biellmann-Position nach dem Layback (SP 8 Umdrehungen, Advanced Novice 6).",
"max_per_element": 1,
"once_per_program": true
}
]
},
"sequence": {
"required_features": [
"variety_of_turns"
],
"level4_requires_any": [],
"features": [
{
"code": "variety_of_turns",
"name": "Vielfalt schwieriger Schritte und Drehungen",
"description": "Mindest-, einfache, volle Vielfalt bzw. Komplexität schwieriger Schritte und Drehungen (verpflichtend).",
"max_per_element": 1,
"once_per_program": true
},
{
"code": "both_rotations",
"name": "Drehungen in beide Richtungen",
"description": "Drehungen in beide Richtungen mit voller Körperdrehung über mindestens je 1/3 des Musters.",
"max_per_element": 1,
"once_per_program": true
},
{
"code": "body_movements",
"name": "Körperbewegungen",
"description": "Körperbewegungen über mindestens 1/3 des Musters.",
"max_per_element": 1,
"once_per_program": true
},
{
"code": "turn_combinations",
"name": "Zwei Drehungs-Kombinationen",
"description": "Zwei Kombinationen aus je 3 schwierigen Drehungen auf verschiedenen Füßen im durchgehenden Fluss.",
"max_per_element": 1,
"once_per_program": true
},
{
"code": "body_movements_in_turns",
"name": "Körperbewegungen in Drehungs-Kombination",
"description": "Körperbewegungen in einer Kombination aus 3 schwierigen Drehungen.",
"max_per_element": 1,
"once_per_program": true
}
]
}
}
}

View file

@ -0,0 +1,373 @@
{
"schema_version": 1,
"season": "2026/27",
"discipline": "Single & Pair Skating",
"valid_from": "2026-07-01",
"source": "ISU Communication No. 2786, Scale of Values and Program Components Factors valid as of July 1, 2026",
"elements": [
{
"code": "1T",
"name": "Single toe loop",
"type": "jump",
"base_value": 0.4
},
{
"code": "1S",
"name": "Single Salchow",
"type": "jump",
"base_value": 0.4
},
{
"code": "1Lo",
"name": "Single loop",
"type": "jump",
"base_value": 0.5
},
{
"code": "1F",
"name": "Single flip",
"type": "jump",
"base_value": 0.5
},
{
"code": "1Lz",
"name": "Single Lutz",
"type": "jump",
"base_value": 0.6
},
{
"code": "1A",
"name": "Single Axel",
"type": "jump",
"base_value": 1.1
},
{
"code": "2T",
"name": "Double toe loop",
"type": "jump",
"base_value": 1.3
},
{
"code": "2S",
"name": "Double Salchow",
"type": "jump",
"base_value": 1.3
},
{
"code": "2Lo",
"name": "Double loop",
"type": "jump",
"base_value": 1.7
},
{
"code": "2F",
"name": "Double flip",
"type": "jump",
"base_value": 1.8
},
{
"code": "2Lz",
"name": "Double Lutz",
"type": "jump",
"base_value": 2.1
},
{
"code": "2A",
"name": "Double Axel",
"type": "jump",
"base_value": 3.3
},
{
"code": "3T",
"name": "Triple toe loop",
"type": "jump",
"base_value": 4.2
},
{
"code": "3S",
"name": "Triple Salchow",
"type": "jump",
"base_value": 4.3
},
{
"code": "3Lo",
"name": "Triple loop",
"type": "jump",
"base_value": 4.9
},
{
"code": "3F",
"name": "Triple flip",
"type": "jump",
"base_value": 5.3
},
{
"code": "3Lz",
"name": "Triple Lutz",
"type": "jump",
"base_value": 5.9
},
{
"code": "3A",
"name": "Triple Axel",
"type": "jump",
"base_value": 8.0
},
{
"code": "4T",
"name": "Quadruple toe loop",
"type": "jump",
"base_value": 9.5
},
{
"code": "4S",
"name": "Quadruple Salchow",
"type": "jump",
"base_value": 9.7
},
{
"code": "4Lo",
"name": "Quadruple loop",
"type": "jump",
"base_value": 10.5
},
{
"code": "4F",
"name": "Quadruple flip",
"type": "jump",
"base_value": 11.0
},
{
"code": "4Lz",
"name": "Quadruple Lutz",
"type": "jump",
"base_value": 11.5
},
{
"code": "4A",
"name": "Quadruple Axel",
"type": "jump",
"base_value": 12.5
},
{
"code": "USp",
"name": "Upright spin",
"type": "spin",
"base_values": {
"B": 1.2,
"1": 1.4,
"2": 1.8,
"3": 2.3,
"4": 2.9
}
},
{
"code": "LSp",
"name": "Layback spin",
"type": "spin",
"base_values": {
"B": 1.4,
"1": 1.8,
"2": 2.3,
"3": 2.9,
"4": 3.2
}
},
{
"code": "CSp",
"name": "Camel spin",
"type": "spin",
"base_values": {
"B": 1.3,
"1": 1.7,
"2": 2.2,
"3": 2.8,
"4": 3.1
}
},
{
"code": "SSp",
"name": "Sit spin",
"type": "spin",
"base_values": {
"B": 1.3,
"1": 1.6,
"2": 1.9,
"3": 2.5,
"4": 3.0
}
},
{
"code": "FUSp",
"name": "Flying upright spin",
"type": "spin",
"base_values": {
"B": 1.8,
"1": 2.0,
"2": 2.4,
"3": 2.9,
"4": 3.5
}
},
{
"code": "FLSp",
"name": "Flying layback spin",
"type": "spin",
"base_values": {
"B": 2.0,
"1": 2.4,
"2": 2.9,
"3": 3.5,
"4": 3.8
}
},
{
"code": "FCSp",
"name": "Flying camel spin",
"type": "spin",
"base_values": {
"B": 1.9,
"1": 2.3,
"2": 2.8,
"3": 3.4,
"4": 3.8
}
},
{
"code": "FSSp",
"name": "Flying sit spin",
"type": "spin",
"base_values": {
"B": 2.0,
"1": 2.4,
"2": 2.8,
"3": 3.1,
"4": 3.6
}
},
{
"code": "CUSp",
"name": "Change foot upright spin",
"type": "spin",
"base_values": {
"B": 1.8,
"1": 2.0,
"2": 2.4,
"3": 2.9,
"4": 3.5
}
},
{
"code": "FCUSp",
"name": "Flying change foot upright spin",
"type": "spin",
"base_values": {
"B": 1.8,
"1": 2.0,
"2": 2.4,
"3": 2.9,
"4": 3.5
}
},
{
"code": "CLSp",
"name": "Change foot layback spin",
"type": "spin",
"base_values": {
"B": 2.0,
"1": 2.4,
"2": 2.9,
"3": 3.5,
"4": 3.8
}
},
{
"code": "FCLSp",
"name": "Flying change foot layback spin",
"type": "spin",
"base_values": {
"B": 2.0,
"1": 2.4,
"2": 2.9,
"3": 3.5,
"4": 3.8
}
},
{
"code": "CoSp",
"name": "Combination spin",
"type": "spin",
"base_values": {
"B": 1.8,
"1": 2.0,
"2": 2.4,
"3": 3.0,
"4": 3.6
}
},
{
"code": "FCoSp",
"name": "Flying combination spin",
"type": "spin",
"base_values": {
"B": 1.8,
"1": 2.0,
"2": 2.4,
"3": 3.0,
"4": 3.6
}
},
{
"code": "CCoSp",
"name": "Change foot combination spin",
"type": "spin",
"base_values": {
"B": 2.0,
"1": 2.4,
"2": 3.0,
"3": 3.6,
"4": 4.2
}
},
{
"code": "FCCoSp",
"name": "Flying change foot combination spin",
"type": "spin",
"base_values": {
"B": 2.0,
"1": 2.4,
"2": 3.0,
"3": 3.6,
"4": 4.2
}
},
{
"code": "StSq",
"name": "Step sequence",
"type": "sequence",
"base_values": {
"B": 1.6,
"1": 1.9,
"2": 2.7,
"3": 3.5,
"4": 4.1
}
},
{
"code": "ChSq",
"name": "Choreographic sequence",
"type": "sequence",
"base_values": {
"1": 3.5
}
},
{
"code": "ChSp",
"name": "Choreographic spin",
"type": "spin",
"base_values": {
"1": 3.5
}
}
]
}

View file

@ -9,7 +9,7 @@ extends RefCounted
## a level suffix ("CCoSp4", "StSqB"). Jump levels are ignored because jumps
## have a single base value.
const DEFAULT_PATH := "res://src/core/rules/data/isu_sov_2025_26.json"
const DEFAULT_PATH := "res://src/core/rules/data/isu_sov_2026_27.json"
const SUPPORTED_SCHEMA_VERSION := 1
const TYPE_BY_NAME := {

View file

@ -9,7 +9,7 @@ extends RefCounted
## only once per program, maximum features per foot) are stored in the data but
## not enforced here yet.
const DEFAULT_PATH := "res://src/core/rules/data/isu_levels_2025_26.json"
const DEFAULT_PATH := "res://src/core/rules/data/isu_levels_2026_27.json"
const SUPPORTED_SCHEMA_VERSION := 1
const MAX_LEVEL := PathSegment.ELEMENT_MAX_LEVEL
@ -19,6 +19,11 @@ const TYPE_BY_NAME := {
"sequence": PathSegment.ElementType.SEQUENCE,
}
const FIXED_LEVEL_TYPES := {
"chsq": PathSegment.ElementType.SEQUENCE,
"chsp": PathSegment.ElementType.SPIN,
}
## Result of evaluating one element's selected features.
class LevelResult extends RefCounted:
var level: int = 0
@ -86,13 +91,13 @@ func get_level4_features(type: PathSegment.ElementType) -> PackedStringArray:
return _level4_by_type[type].duplicate()
## Fixed level for elements that are not feature-based (ChSq), or -1.
## Fixed level for elements that are not feature-based (ChSq, ChSp), or -1.
func get_fixed_level(type: PathSegment.ElementType, code: String) -> int:
if type != PathSegment.ElementType.SEQUENCE:
return -1
var key := _normalize(code)
if not _fixed_levels.has(key):
return -1
if FIXED_LEVEL_TYPES.get(key, PathSegment.ElementType.NONE) != type:
return -1
return _fixed_levels[key]
@ -113,7 +118,7 @@ func calculate_level(
var result := LevelResult.new()
var key := _normalize(code)
if _fixed_levels.has(key):
if type == PathSegment.ElementType.SEQUENCE:
if FIXED_LEVEL_TYPES.get(key, PathSegment.ElementType.NONE) == type:
result.level = _fixed_levels[key]
return result

View file

@ -8,11 +8,17 @@ extends RefCounted
var _catalog: ElementCatalog
var _rules: ElementLevelRules
var _adult_rules: AdultCategoryRules
func _init(catalog: ElementCatalog, rules: ElementLevelRules) -> void:
func _init(
catalog: ElementCatalog,
rules: ElementLevelRules,
adult_rules: AdultCategoryRules = null
) -> void:
_catalog = catalog
_rules = rules
_adult_rules = adult_rules
## Returns the findings only. Use [method validate_report] when the UI also
@ -52,6 +58,7 @@ func validate_report(routine: Routine) -> ValidationReport:
_collect_program_features(segment, section.section_id, seen_once, report)
_collect_base_value(segment, section.section_id, report)
_validate_category(routine, report)
return report
@ -79,6 +86,207 @@ func _collect_base_value(
report.scored_elements += 1
func _validate_category(
routine: Routine,
report: ValidationReport
) -> void:
var category_code := routine.adult_category.strip_edges()
if category_code.is_empty() or _adult_rules == null:
return
var category := _adult_rules.get_category(category_code)
if category == null:
_add(
report,
"category",
ValidationIssue.Severity.ERROR,
"Unbekannte Adult-Kategorie „%s“." % category_code
)
return
_pass(report, "category")
var jumps := 0
var spins := 0
var step_sequences := 0
var choreographic_sequences := 0
var choreographic_spins := 0
var axel_present := false
var jump_type_failed := false
var level_failed := false
for section: RoutineSection in routine.sections:
if section == null:
continue
for segment: PathSegment in section.segments:
if segment == null or not segment.is_element():
continue
var code := segment.element_code.strip_edges()
var lower := code.to_lower()
match segment.element_type:
PathSegment.ElementType.JUMP:
jumps += 1
if AdultCategoryRules.Category.jump_type(code) == "A":
axel_present = true
if not category.is_jump_allowed(code):
_append(
report,
ValidationIssue.Severity.WARNING,
"„%s“ ist in %s nicht erlaubt."
% [code, category.name],
section.section_id,
segment.segment_id
)
jump_type_failed = true
PathSegment.ElementType.SPIN:
spins += 1
if lower.begins_with("chsp"):
choreographic_spins += 1
if segment.element_level > category.max_spin_level:
_append(
report,
ValidationIssue.Severity.WARNING,
"„%s“ hat Level %d; %s erlaubt bei Pirouetten max. Level %d."
% [
code,
segment.element_level,
category.name,
category.max_spin_level,
],
section.section_id,
segment.segment_id
)
level_failed = true
PathSegment.ElementType.SEQUENCE:
if lower.begins_with("chsq"):
choreographic_sequences += 1
else:
step_sequences += 1
if segment.element_level > category.max_sequence_level:
_append(
report,
ValidationIssue.Severity.WARNING,
"„%s“ hat Level %d; %s erlaubt bei Sequenzen max. Level %d."
% [
code,
segment.element_level,
category.name,
category.max_sequence_level,
],
section.section_id,
segment.segment_id
)
level_failed = true
_check_category_count(
report,
"category_jumps",
jumps,
category.max_jump_elements,
"Sprungelemente",
category.name
)
_check_category_count(
report,
"category_spins",
spins,
category.max_spins,
"Pirouetten",
category.name
)
var sequence_failed := false
if step_sequences > category.max_step_sequences:
_append(
report,
ValidationIssue.Severity.WARNING,
"Schrittsequenzen: %d, erlaubt sind max. %d (%s)."
% [step_sequences, category.max_step_sequences, category.name]
)
sequence_failed = true
if choreographic_sequences > category.max_choreographic_sequences:
_append(
report,
ValidationIssue.Severity.WARNING,
"Choreo-Sequenzen: %d, erlaubt sind max. %d (%s)."
% [
choreographic_sequences,
category.max_choreographic_sequences,
category.name,
]
)
sequence_failed = true
if sequence_failed:
_fail(report, "category_sequences", false)
else:
_pass(report, "category_sequences")
if jump_type_failed:
_fail(report, "category_jump_types", false)
else:
_pass(report, "category_jump_types")
if spins > 0 or step_sequences > 0 or choreographic_sequences > 0:
if level_failed:
_fail(report, "category_levels", false)
else:
_pass(report, "category_levels")
var required_failed := false
if category.required_axel and not axel_present:
_append(
report,
ValidationIssue.Severity.WARNING,
"%s verlangt einen Axel-Sprung." % category.name
)
required_failed = true
if category.requires_choreographic_spin and choreographic_spins == 0:
_append(
report,
ValidationIssue.Severity.WARNING,
"%s verlangt eine Choreographic Spin (ChSp)." % category.name
)
required_failed = true
if step_sequences < category.required_step_sequences:
_append(
report,
ValidationIssue.Severity.WARNING,
"%s verlangt mindestens %d Schrittsequenz(en)."
% [category.name, category.required_step_sequences]
)
required_failed = true
if choreographic_sequences < category.required_choreographic_sequences:
_append(
report,
ValidationIssue.Severity.WARNING,
"%s verlangt mindestens %d Choreo-Sequenz(en)."
% [category.name, category.required_choreographic_sequences]
)
required_failed = true
if required_failed:
_fail(report, "category_required", false)
else:
_pass(report, "category_required")
func _check_category_count(
report: ValidationReport,
check_code: String,
count: int,
maximum: int,
label: String,
category_name: String
) -> void:
if count > maximum:
_append(
report,
ValidationIssue.Severity.WARNING,
"%s: %d, erlaubt sind max. %d (%s)."
% [label, count, maximum, category_name]
)
_fail(report, check_code, false)
else:
_pass(report, check_code)
func _validate_segment(
segment: PathSegment,
section_id: String,

View file

@ -13,6 +13,13 @@ const CHECK_ORDER := [
"required",
"level_features",
"once",
"category",
"category_jumps",
"category_jump_types",
"category_spins",
"category_sequences",
"category_levels",
"category_required",
]
const CHECK_LABELS := {
@ -24,6 +31,13 @@ const CHECK_LABELS := {
"required": "Pflichtfeatures",
"level_features": "Level aus Features",
"once": "Einmal pro Programm",
"category": "Kategorie",
"category_jumps": "Kategorie: Sprunganzahl",
"category_jump_types": "Kategorie: erlaubte Sprünge",
"category_spins": "Kategorie: Pirouetten",
"category_sequences": "Kategorie: Sequenzen",
"category_levels": "Kategorie: Level-Grenzen",
"category_required": "Kategorie: Pflichtelemente",
}
var issues: Array[ValidationIssue] = []

View file

@ -52,6 +52,7 @@ const EXPORT_SHEET_SCENE := preload("res://scenes/export/export_sheet.tscn")
const ELEMENT_CATALOG_SCRIPT := preload("res://src/core/rules/element_catalog.gd")
const ELEMENT_LEVEL_RULES_SCRIPT := preload("res://src/core/rules/element_level_rules.gd")
const ROUTINE_VALIDATOR_SCRIPT := preload("res://src/core/rules/routine_validator.gd")
const ADULT_CATEGORY_RULES_SCRIPT := preload("res://src/core/rules/adult_category_rules.gd")
const FEATURE_MENU_RESET_ID := 1000000
const CODE_OPTION_PLACEHOLDER_ID := 0
const CODE_OPTION_FREE_ID := 1000000
@ -121,6 +122,7 @@ const COMPACT_LAYOUT_WIDTH := 1280.0
@onready var element_feature_hint: Label = %ElementFeatureHint
@onready var element_feature_menu: PopupMenu = %ElementFeatureMenu
@onready var validation_button: Button = %ValidationButton
@onready var adult_category_option: OptionButton = %AdultCategoryOption
@onready var validation_dialog: AcceptDialog = %ValidationDialog
@onready var validation_text: RichTextLabel = %ValidationText
@onready var element_duration_spin: SpinBox = %ElementDurationSpin
@ -165,6 +167,7 @@ var _element_type: PathSegment.ElementType = PathSegment.ElementType.JUMP
var _element_level: int = 0
var _element_catalog: ElementCatalog
var _level_rules: ElementLevelRules
var _adult_rules: AdultCategoryRules
var _dialog_features: PackedStringArray = PackedStringArray()
var _show_score_info: bool = false
var _preset_speed: float = DEFAULT_SPEED_MPS
@ -202,6 +205,11 @@ func _ready() -> void:
push_warning(
"Level rules: %s" % ", ".join(_level_rules.get_errors())
)
_adult_rules = ADULT_CATEGORY_RULES_SCRIPT.load_default()
if not _adult_rules.get_errors().is_empty():
push_warning(
"Adult categories: %s" % ", ".join(_adult_rules.get_errors())
)
validation_button.tooltip_text = (
"Prüft Kürzel, Elementtyp, Level, Features und Einmal-Regeln (Saison %s)"
% _element_catalog.season
@ -211,6 +219,7 @@ func _ready() -> void:
_setup_playback_controls()
_setup_timing_controls()
_setup_element_controls()
_setup_adult_category_controls()
_setup_export_controls()
labels_toggle.set_pressed_no_signal(rink_canvas.labels_visible)
@ -443,7 +452,8 @@ func get_level_rules() -> ElementLevelRules:
func validate_routine() -> Array[ValidationIssue]:
var validator: RoutineValidator = ROUTINE_VALIDATOR_SCRIPT.new(
_element_catalog,
_level_rules
_level_rules,
_adult_rules
)
return validator.validate(_routine)
@ -458,7 +468,8 @@ func open_validation_dialog() -> void:
func _render_validation_dialog() -> void:
var validator: RoutineValidator = ROUTINE_VALIDATOR_SCRIPT.new(
_element_catalog,
_level_rules
_level_rules,
_adult_rules
)
var report := validator.validate_report(_routine)
var errors := RoutineValidator.count_severity(
@ -482,6 +493,20 @@ func _render_validation_dialog() -> void:
season,
]
)
var category_name := "Ohne Kategorie"
if (
_routine != null
and not _routine.adult_category.is_empty()
and _adult_rules != null
):
var category := _adult_rules.get_category(_routine.adult_category)
if category != null:
category_name = "%s · %s ±%d s" % [
category.name,
_format_duration(category.duration_seconds),
category.duration_tolerance_seconds,
]
lines.append("[b]Kategorie: %s[/b]" % category_name)
lines.append("")
lines.append(
"[b]Basiswert: %s[/b]" % _format_base_value(report.base_value_total)
@ -614,6 +639,8 @@ func _validation_check_line(check: ValidationCheck) -> String:
func _validation_skip_reason(check_code: String) -> String:
if check_code.begins_with("category"):
return "keine Kategorie oder keine passenden Elemente"
match check_code:
"code":
return "keine Elemente"
@ -680,6 +707,10 @@ static func _format_base_value(value: float) -> String:
return ("%.2f" % value).replace(".", ",")
static func _format_duration(seconds: int) -> String:
return "%d:%02d" % [seconds / 60, seconds % 60]
func _on_validation_meta_clicked(meta: Variant) -> void:
if str(meta) != "score_info":
return
@ -1343,6 +1374,62 @@ func _setup_element_controls() -> void:
element_feature_menu.popup_hide.connect(_on_feature_menu_hidden)
func _setup_adult_category_controls() -> void:
adult_category_option.clear()
adult_category_option.add_item("Ohne Kategorie", 0)
adult_category_option.set_item_metadata(0, "")
if _adult_rules != null:
for category: AdultCategoryRules.Category in _adult_rules.get_categories():
var index := adult_category_option.item_count
adult_category_option.add_item(category.name, index)
adult_category_option.set_item_metadata(index, category.code)
adult_category_option.item_selected.connect(_on_adult_category_selected)
_sync_adult_category_option()
func _on_adult_category_selected(index: int) -> void:
set_adult_category(str(adult_category_option.get_item_metadata(index)))
func set_adult_category(code: String) -> bool:
if _routine == null:
return false
var cleaned := code.strip_edges().to_lower()
if (
not cleaned.is_empty()
and (_adult_rules == null or not _adult_rules.has_category(cleaned))
):
return false
if _routine.adult_category == cleaned:
return false
_record_undo()
_routine.adult_category = cleaned
_sync_adult_category_option()
_mark_dirty()
_update_status()
return true
func get_adult_category() -> String:
return _routine.adult_category if _routine != null else ""
func get_adult_rules() -> AdultCategoryRules:
return _adult_rules
func _sync_adult_category_option() -> void:
if adult_category_option == null:
return
var code := _routine.adult_category if _routine != null else ""
for index: int in range(adult_category_option.item_count):
if str(adult_category_option.get_item_metadata(index)) == code:
adult_category_option.select(index)
return
if adult_category_option.item_count > 0:
adult_category_option.select(0)
func _on_element_code_text_changed(_text: String) -> void:
_update_level_control_state()
update_element_feature_hint()
@ -1634,6 +1721,7 @@ func _clone_routine(source: Routine) -> Routine:
clone.routine_id = source.routine_id
clone.title = source.title
clone.skater_name = source.skater_name
clone.adult_category = source.adult_category
if source.rink != null:
clone.rink = _clone_rink(source.rink)
@ -2696,6 +2784,7 @@ func _install_routine(
_routine = routine
if _routine.rink == null or not _routine.rink.is_valid():
_routine.rink = RinkDimensions.new()
_sync_adult_category_option()
var valid_sections: Array[RoutineSection] = []
for section: RoutineSection in _routine.sections:

View file

@ -30,6 +30,9 @@ $GODOT --headless --path rinkplanner --script res://tests/run_level_tests.gd
# Run routine element-validation tests
$GODOT --headless --path rinkplanner --script res://tests/run_validation_tests.gd
# Run adult category tests
$GODOT --headless --path rinkplanner --script res://tests/run_adult_tests.gd
# Run canvas transform/geometry tests
$GODOT --headless --path rinkplanner --script res://tests/run_canvas_tests.gd

View file

@ -91,6 +91,9 @@ func _capture() -> void:
controller.element_button.pressed.emit()
elif args.size() > 3 and args[3] == "validate":
controller.open_validation_dialog()
elif args.size() > 3 and args[3] == "adultgold":
controller.set_adult_category("gold")
controller.open_validation_dialog()
elif args.size() > 3 and args[3] == "scoreinfo":
controller.open_validation_dialog()
controller.validation_text.meta_clicked.emit("score_info")

View file

@ -0,0 +1,274 @@
extends SceneTree
## Headless tests for the 2026/27 adult category rules and their validation.
##
## Run with:
## godot --headless --path rinkplanner --script res://tests/run_adult_tests.gd
const ElementCatalogScript := preload("res://src/core/rules/element_catalog.gd")
const ElementLevelRulesScript := preload("res://src/core/rules/element_level_rules.gd")
const AdultCategoryRulesScript := preload("res://src/core/rules/adult_category_rules.gd")
const RoutineValidatorScript := preload("res://src/core/rules/routine_validator.gd")
const RoutineModel := preload("res://src/core/model/routine.gd")
const RoutineSectionModel := preload("res://src/core/model/routine_section.gd")
const PathSegmentModel := preload("res://src/core/model/path_segment.gd")
var _assertions: int = 0
var _failures: PackedStringArray = PackedStringArray()
var _catalog: ElementCatalog
var _rules: ElementLevelRules
var _adult: AdultCategoryRules
var _validator: RoutineValidator
func _init() -> void:
_catalog = ElementCatalogScript.load_default()
_rules = ElementLevelRulesScript.load_default()
_adult = AdultCategoryRulesScript.load_default()
_validator = RoutineValidatorScript.new(_catalog, _rules, _adult)
_test_metadata()
_test_category_fields()
_test_jump_permissions()
_test_gold_limits()
_test_valid_gold()
_test_unknown_category()
_finish()
func _test_metadata() -> void:
_check(_adult.is_valid(), "adult rules are valid")
_check(_adult.season == "2026/27", "adult rules season is 2026/27")
_check(_adult.source.contains("Adult"), "adult rules name the adult announcement")
_check(
_adult.get_categories().size() == 5,
"five adult categories are available"
)
_check(_adult.has_category("gold"), "Gold category exists")
_check(_adult.has_category("silver"), "Silver category exists")
_check(_adult.has_category("bronze"), "Bronze category exists")
func _test_category_fields() -> void:
var gold := _adult.get_category("gold")
_check(gold.duration_seconds == 170, "Gold lasts 2:50")
_check(gold.max_jump_elements == 5, "Gold allows five jump elements")
_check(gold.max_spins == 3, "Gold allows three spins")
_check(gold.max_step_sequences == 1, "Gold allows one step sequence")
_check(gold.max_choreographic_sequences == 0, "Gold has no choreo sequence")
_check(gold.requires_choreographic_spin, "Gold requires a choreographic spin")
_check(gold.max_spin_level == 3, "Gold caps spins at Level 3")
_check(gold.max_sequence_level == 2, "Gold caps sequences at Level 2")
_check_approx(gold.pcs_factor, 2.67, "Gold PCS factor")
_check_approx(gold.fall_deduction, 1.0, "Gold fall deduction")
var silver := _adult.get_category("silver")
_check(silver.duration_seconds == 120, "Silver lasts 2:00")
_check(silver.max_spins == 2, "Silver allows two spins")
_check(silver.max_choreographic_sequences == 1, "Silver uses a choreo sequence")
_check(not silver.requires_choreographic_spin, "Silver needs no choreo spin")
_check(silver.max_spin_level == 2, "Silver caps spins at Level 2")
_check_approx(silver.pcs_factor, 2.0, "Silver PCS factor")
var bronze := _adult.get_category("bronze")
_check(bronze.duration_seconds == 100, "Bronze lasts 1:40")
_check(not bronze.allow_axel, "Bronze forbids Axel jumps")
_check(bronze.max_jump_combinations == 1, "Bronze allows one jump combination")
_check(bronze.max_spin_level == 1, "Bronze caps spins at Level 1")
func _test_jump_permissions() -> void:
var bronze := _adult.get_category("bronze")
_check(bronze.is_jump_allowed("1T"), "Bronze allows 1T")
_check(not bronze.is_jump_allowed("1A"), "Bronze forbids 1A")
_check(not bronze.is_jump_allowed("2T"), "Bronze forbids doubles")
var silver := _adult.get_category("silver")
_check(silver.is_jump_allowed("1A"), "Silver allows 1A")
_check(not silver.is_jump_allowed("2T"), "Silver forbids doubles")
var gold := _adult.get_category("gold")
_check(gold.is_jump_allowed("1A"), "Gold allows 1A")
_check(gold.is_jump_allowed("2T"), "Gold allows 2T")
_check(not gold.is_jump_allowed("2Lz"), "Gold forbids 2Lz")
_check(not gold.is_jump_allowed("2A"), "Gold forbids 2A")
_check(not gold.is_jump_allowed("3T"), "Gold forbids triples")
var masters := _adult.get_category("masters")
_check(masters.is_jump_allowed("2A"), "Masters allows 2A")
_check(not masters.is_jump_allowed("3T"), "Masters forbids triples")
var elite := _adult.get_category("masters_elite")
_check(elite.is_jump_allowed("3T"), "Masters Elite allows triples")
_check(not elite.is_jump_allowed("4T"), "Masters Elite forbids quads")
func _test_gold_limits() -> void:
var routine := _make_routine("gold")
var section := routine.sections[0]
for code: String in ["1T", "1S", "1Lo", "2T", "2S", "3T"]:
_add_jump(section, code)
for index: int in range(4):
_add_spin(section, "spin-%d" % index, "CCoSp", 4)
_add_sequence(section, "step", "StSq", 3)
var report := _validator.validate_report(routine)
_check(
report.get_check("category").passed == 1,
"the category itself is recognised"
)
_check(
report.get_check("category_jumps").warnings == 1,
"six jumps exceed the Gold limit"
)
_check(
report.get_check("category_jump_types").warnings == 1,
"3T is not allowed in Gold"
)
_check(
report.get_check("category_spins").warnings == 1,
"four spins exceed the Gold limit"
)
_check(
report.get_check("category_levels").warnings == 1,
"Level 4 exceeds the Gold level caps"
)
_check(
report.get_check("category_required").warnings == 1,
"the missing choreographic spin is reported"
)
_check(_has_message(report, "Sprungelemente: 6"), "jump count message")
_check(_has_message(report, "„3T“ ist in Gold nicht erlaubt"), "forbidden jump message")
_check(_has_message(report, "Pirouetten: 4"), "spin count message")
_check(_has_message(report, "max. Level 3"), "spin level cap message")
_check(_has_message(report, "Choreographic Spin"), "choreo spin message")
func _test_valid_gold() -> void:
var routine := _make_routine("gold")
var section := routine.sections[0]
for code: String in ["1A", "2T", "2S"]:
_add_jump(section, code)
_add_spin(section, "spin-a", "CCoSp", 3)
_add_spin(section, "spin-b", "FUSp", 3)
_add_spin(section, "spin-chsp", "ChSp", 1)
_add_sequence(section, "step", "StSq", 2)
var report := _validator.validate_report(routine)
_check(report.issues.is_empty(), "a valid Gold program has no findings")
_check(
report.get_check("category_jumps").passed == 1,
"the Gold jump count passes"
)
_check(
report.get_check("category_spins").passed == 1,
"the Gold spin count passes"
)
_check(
report.get_check("category_sequences").passed == 1,
"the Gold sequence count passes"
)
_check(
report.get_check("category_levels").passed == 1,
"the Gold level caps pass"
)
_check(
report.get_check("category_required").passed == 1,
"the Gold required elements pass"
)
func _test_unknown_category() -> void:
var routine := _make_routine("unknown")
var report := _validator.validate_report(routine)
_check(report.get_check("category").errors == 1, "an unknown category is an error")
_check(_has_message(report, "Unbekannte Adult-Kategorie"), "unknown category message")
func _make_routine(category: String) -> Routine:
var routine: Routine = RoutineModel.new()
routine.routine_id = "adult-test"
routine.title = "Adult"
routine.adult_category = category
var section: RoutineSection = RoutineSectionModel.new()
section.section_id = "section-001"
section.title = "Abschnitt 1"
section.sequence_order = 0
var sections: Array[RoutineSection] = [section]
routine.sections = sections
return routine
func _add_jump(section: RoutineSection, code: String) -> PathSegment:
var segment: PathSegment = PathSegmentModel.new()
segment.segment_id = "jump-%d" % section.segments.size()
segment.curve = _make_point_curve(Vector2.ZERO)
segment.set_element(PathSegment.ElementType.JUMP, code, 0)
section.segments.append(segment)
return segment
func _add_spin(
section: RoutineSection,
segment_id: String,
code: String,
level: int
) -> PathSegment:
var segment: PathSegment = PathSegmentModel.new()
segment.segment_id = segment_id
segment.curve = _make_point_curve(Vector2.ZERO)
segment.set_element(PathSegment.ElementType.SPIN, code, level)
section.segments.append(segment)
return segment
func _add_sequence(
section: RoutineSection,
segment_id: String,
code: String,
level: int
) -> PathSegment:
var segment: PathSegment = PathSegmentModel.new()
segment.segment_id = segment_id
segment.curve = _make_point_curve(Vector2.ZERO)
segment.set_element(PathSegment.ElementType.SEQUENCE, code, level)
section.segments.append(segment)
return segment
func _make_point_curve(point: Vector2) -> Curve2D:
var curve := Curve2D.new()
curve.add_point(point)
return curve
func _has_message(report: ValidationReport, fragment: String) -> bool:
for issue: ValidationIssue in report.issues:
if issue.message.contains(fragment):
return true
return false
func _check(condition: bool, message: String) -> void:
_assertions += 1
if not condition:
_failures.append(message)
func _check_approx(actual: float, expected: float, message: String) -> void:
_check(
absf(actual - expected) <= 0.001,
"%s (expected %.3f, got %.3f)" % [message, expected, actual]
)
func _finish() -> void:
if _failures.is_empty():
print("PASS: %d assertions" % _assertions)
quit(0)
return
for failure: String in _failures:
printerr("FAIL: %s" % failure)
printerr("%d of %d assertions failed" % [_failures.size(), _assertions])
quit(1)

View file

@ -0,0 +1 @@
uid://bgwttvsrlquvj

View file

@ -32,16 +32,16 @@ func _test_rules_metadata() -> void:
"level rules parse without errors (%s)" % ", ".join(_rules.get_errors())
)
_check(_rules.is_valid(), "level rules are valid")
_check(_rules.season == "2025/26", "level rules season is 2025/26")
_check(_rules.source.contains("2701"), "level rules name ISU communication 2701")
_check(_rules.valid_from == "2025-07-01", "level rules valid from 2025-07-01")
_check(_rules.season == "2026/27", "level rules season is 2026/27")
_check(_rules.source.contains("2788"), "level rules name ISU communication 2788")
_check(_rules.valid_from == "2026-06-01", "level rules valid from 2026-06-01")
_check(
_rules.get_features(PathSegment.ElementType.SPIN).size() == 14,
"spin rules contain 14 features"
_rules.get_features(PathSegment.ElementType.SPIN).size() == 15,
"spin rules contain 15 features"
)
_check(
_rules.get_features(PathSegment.ElementType.SEQUENCE).size() == 4,
"sequence rules contain 4 features"
_rules.get_features(PathSegment.ElementType.SEQUENCE).size() == 5,
"sequence rules contain 5 features"
)
_check(
_rules.get_features(PathSegment.ElementType.JUMP).is_empty(),
@ -198,6 +198,22 @@ func _test_fixed_and_unlevelled_elements() -> void:
).level == 0,
"a fixed level only applies to the matching element type"
)
var chsp := _rules.calculate_level(
PathSegment.ElementType.SPIN,
"ChSp",
PackedStringArray()
)
_check(chsp.level == 1, "ChSp is fixed at Level 1")
var chsp_with_features := _rules.calculate_level(
PathSegment.ElementType.SPIN,
"ChSp1",
PackedStringArray(["difficult_exit"])
)
_check(chsp_with_features.level == 1, "ChSp ignores feature selections")
_check(
_rules.get_fixed_level(PathSegment.ElementType.SPIN, "ChSp") == 1,
"ChSp exposes its fixed level"
)
var jump := _rules.calculate_level(
PathSegment.ElementType.JUMP,
@ -254,10 +270,16 @@ func _test_feature_validation() -> void:
== PackedStringArray(["variety_of_turns"]),
"required sequence features are exposed"
)
var level4_features := _rules.get_level4_features(spins)
_check(
_rules.get_level4_features(spins).size() == 6,
level4_features.size() == 6,
"six spin features unlock Level 4"
)
_check(
level4_features.has("windmills")
and not level4_features.has("difficult_position_change"),
"the 2026/27 Level-4 list contains windmills instead of the position change"
)
func _test_segment_features() -> void:

View file

@ -35,17 +35,17 @@ func _test_catalog_metadata() -> void:
"catalog parses without errors (%s)" % ", ".join(_catalog.get_errors())
)
_check(_catalog.is_valid(), "catalog is valid")
_check(_catalog.season == "2025/26", "catalog season is 2025/26")
_check(_catalog.source.contains("2707"), "catalog names ISU communication 2707")
_check(_catalog.valid_from == "2025-07-01", "catalog valid from 2025-07-01")
_check(_catalog.get_definition_count() == 42, "catalog has 42 element families")
_check(_catalog.season == "2026/27", "catalog season is 2026/27")
_check(_catalog.source.contains("2786"), "catalog names ISU communication 2786")
_check(_catalog.valid_from == "2026-07-01", "catalog valid from 2026-07-01")
_check(_catalog.get_definition_count() == 43, "catalog has 43 element families")
_check(
_catalog.get_codes(PathSegment.ElementType.JUMP).size() == 24,
"catalog has 24 jump families"
)
_check(
_catalog.get_codes(PathSegment.ElementType.SPIN).size() == 16,
"catalog has 16 spin families"
_catalog.get_codes(PathSegment.ElementType.SPIN).size() == 17,
"catalog has 17 spin families"
)
_check(
_catalog.get_codes(PathSegment.ElementType.SEQUENCE).size() == 2,
@ -93,22 +93,37 @@ func _test_jump_values() -> void:
func _test_spin_values() -> void:
_check_approx(_catalog.get_base_value("USpB"), 1.00, "USpB base value")
_check_approx(_catalog.get_base_value("USp4"), 2.40, "USp4 base value")
_check_approx(_catalog.get_base_value("LSp4"), 2.70, "LSp4 base value")
_check_approx(_catalog.get_base_value("FCSp4"), 3.20, "FCSp4 base value")
_check_approx(_catalog.get_base_value("CCoSpB"), 1.70, "CCoSpB base value")
_check_approx(_catalog.get_base_value("CCoSp4"), 3.50, "CCoSp4 base value")
_check_approx(_catalog.get_base_value("USpB"), 1.20, "USpB base value")
_check_approx(_catalog.get_base_value("USp4"), 2.90, "USp4 base value")
_check_approx(_catalog.get_base_value("LSp4"), 3.20, "LSp4 base value")
_check_approx(_catalog.get_base_value("FCSp4"), 3.80, "FCSp4 base value")
_check_approx(_catalog.get_base_value("CCoSpB"), 2.00, "CCoSpB base value")
_check_approx(_catalog.get_base_value("CCoSp4"), 4.20, "CCoSp4 base value")
_check_approx(
_catalog.get_base_value("CCoSp", 4),
3.50,
4.20,
"spin lookup by family and level"
)
_check_approx(
_catalog.get_base_value("CCoSp4", -1),
3.50,
4.20,
"spin lookup infers the level suffix"
)
_check_approx(
_catalog.get_base_value("ChSp1"),
3.50,
"ChSp1 base value"
)
var choreo_spin := _catalog.find("ChSp")
_check(
choreo_spin != null
and choreo_spin.element_type == PathSegment.ElementType.SPIN,
"ChSp is a spin family"
)
_check(
choreo_spin.get_codes() == PackedStringArray(["ChSp1"]),
"ChSp has only its fixed canonical level"
)
var combination: ElementDefinition = _catalog.find("CCoSp")
_check(combination != null, "CCoSp family exists")
@ -129,12 +144,12 @@ func _test_spin_values() -> void:
func _test_sequence_values() -> void:
_check_approx(_catalog.get_base_value("StSqB"), 1.50, "StSqB base value")
_check_approx(_catalog.get_base_value("StSq3"), 3.30, "StSq3 base value")
_check_approx(_catalog.get_base_value("ChSq1"), 3.00, "ChSq1 base value")
_check_approx(_catalog.get_base_value("StSqB"), 1.60, "StSqB base value")
_check_approx(_catalog.get_base_value("StSq3"), 3.50, "StSq3 base value")
_check_approx(_catalog.get_base_value("ChSq1"), 3.50, "ChSq1 base value")
_check_approx(
_catalog.get_base_value("ChSq"),
3.00,
3.50,
"single-level sequence resolves without a suffix"
)
_check_approx(
@ -170,17 +185,17 @@ func _test_lookup_rules() -> void:
)
_check_approx(
_catalog.get_base_value("CCoSp4", 2),
3.50,
4.20,
"a canonical suffix wins over the level argument"
)
_check_approx(
_catalog.get_base_value("StSqB", 4),
1.50,
1.60,
"a Base suffix wins over a graded level argument"
)
_check_approx(
_catalog.get_base_value("ChSq1", 0),
3.00,
3.50,
"an explicit sequence suffix wins over level 0"
)
_check_approx(
@ -230,10 +245,20 @@ func _test_segment_integration() -> void:
spin.set_element(PathSegment.ElementType.SPIN, "CCoSp", 4)
_check_approx(
_catalog.get_segment_base_value(spin),
3.50,
4.20,
"segment integration resolves a spin"
)
var choreo_spin: PathSegment = PathSegmentModel.new()
choreo_spin.segment_id = "choreo-spin"
choreo_spin.curve = _make_point_curve(Vector2.ZERO)
choreo_spin.set_element(PathSegment.ElementType.SPIN, "ChSp", 1)
_check_approx(
_catalog.get_segment_base_value(choreo_spin),
3.50,
"segment integration resolves a choreographic spin"
)
var jump: PathSegment = PathSegmentModel.new()
jump.segment_id = "jump"
jump.curve = _make_point_curve(Vector2.ZERO)
@ -250,7 +275,7 @@ func _test_segment_integration() -> void:
sequence.set_element(PathSegment.ElementType.SEQUENCE, "StSq", 3)
_check_approx(
_catalog.get_segment_base_value(sequence),
3.30,
3.50,
"segment integration resolves a sequence"
)

View file

@ -95,8 +95,8 @@ func _test_clean_routine() -> void:
_check(report.get_check("once").passed == 6, "once-per-program features were checked")
_check_approx(
report.base_value_total,
7.40,
"the report sums the base values (3.50 + 3.90)"
8.30,
"the report sums the base values (4.20 + 4.10)"
)
_check(report.scored_elements == 2, "both elements were scored")
_check(report.unscored_elements == 0, "no element is unscored")
@ -228,7 +228,7 @@ func _test_fixed_level() -> void:
)
_check(valid.issues.is_empty(), "ChSq at Level 1 is valid")
_check(valid.get_check("fixed_level").passed == 1, "the fixed-level check passes")
_check_approx(valid.base_value_total, 3.00, "ChSq contributes 3.00")
_check_approx(valid.base_value_total, 3.50, "ChSq contributes 3.50")
func _test_missing_code() -> void:

View file

@ -799,9 +799,9 @@ func _run() -> void:
"the level is read-only for a catalog spin"
)
var catalog := controller.get_element_catalog()
_check(catalog != null and catalog.season == "2025/26", "controller loads the ISU catalog")
_check(catalog != null and catalog.season == "2026/27", "controller loads the ISU catalog")
_check(
controller.element_value_label.text.contains("3,50"),
controller.element_value_label.text.contains("4,20"),
"element dialog shows the base value of the current code and level"
)
@ -820,7 +820,7 @@ func _run() -> void:
)
controller.update_element_value_hint()
_check(
controller.element_value_label.text.contains("2,50"),
controller.element_value_label.text.contains("3,00"),
"base value follows the derived level 2"
)
@ -830,7 +830,7 @@ func _run() -> void:
"free-text mode shows the text field"
)
_check(
controller.element_value_label.text.contains("3,50"),
controller.element_value_label.text.contains("4,20"),
"a canonical suffix wins over the derived level"
)
@ -864,8 +864,8 @@ func _run() -> void:
"feature menu populates for a spin"
)
_check(
controller.element_feature_menu.item_count == 17,
"feature menu lists 14 features plus the second difficult variation"
controller.element_feature_menu.item_count == 18,
"feature menu lists 15 features plus the second difficult variation"
)
_check(
controller.element_feature_menu.get_item_metadata(0) == "difficult_variation",
@ -1249,7 +1249,7 @@ func _run() -> void:
)
_check(
controller.validation_text.text.contains("Geprüft: 1 Element in 1 Abschnitt")
and controller.validation_text.text.contains("Saison 2025/26"),
and controller.validation_text.text.contains("Saison 2026/27"),
"validation dialog states the scope of the check"
)
_check(
@ -1323,11 +1323,53 @@ func _run() -> void:
)
_check(
controller.validation_text.text.contains("Basiswert")
and controller.validation_text.text.contains("1,70"),
and controller.validation_text.text.contains("2,00"),
"clean validation shows the base value of a Base spin"
)
controller.validation_dialog.hide()
# Adult category validation.
controller.new_routine()
_check(controller.set_adult_category("gold"), "Gold category can be selected")
_check(controller.get_adult_category() == "gold", "the routine stores the category")
var selected_category := controller.adult_category_option.selected
_check(
str(controller.adult_category_option.get_item_metadata(selected_category))
== "gold",
"the category dropdown reflects the routine"
)
for code: String in ["1T", "1S", "1Lo", "2T", "2S", "3T"]:
controller.add_element_marker(
Vector2(0.0, 0.0),
PathSegment.ElementType.JUMP,
code,
0
)
var category_issues := controller.validate_routine()
_check(
category_issues.size() >= 3,
"the Gold category reports count, jump-type and required-element findings"
)
controller.open_validation_dialog()
_check(
controller.validation_text.text.contains("Kategorie: Gold"),
"validation dialog names the adult category"
)
_check(
controller.validation_text.text.contains("Sprungelemente: 6"),
"validation dialog reports the jump count"
)
_check(
controller.validation_text.text.contains("3T")
and controller.validation_text.text.contains("nicht erlaubt"),
"validation dialog reports a forbidden Gold jump"
)
_check(
controller.validation_text.text.contains("Choreographic Spin"),
"validation dialog reports the missing choreographic spin"
)
controller.validation_dialog.hide()
scene.queue_free()
await process_frame
_finish()