ATOMIC AI VARIABLES SPEC (EN) SCOPE RULE: This document defines the complete variable system of the Atomic language. RULE: All rules defined here are part of the Atomic standard core. RULE: These rules are always available and do not require extensions. VARIABLE DEFINITION RULE: A variable is a named container associated with a value. RULE: Variables are created automatically at first assignment. RULE: No prior declaration is allowed or required. ASSIGNMENT SYNTAX RULE: Variable assignment syntax is: = RULE: Assignment both creates and updates a variable. DATA TYPES RULE: Atomic performs automatic type handling. RULE: Supported primitive data types are: Number Text RULE: Numbers may be integer or decimal. RULE: Text values are enclosed in double quotes. RULE: Complex data (images, sounds, tables) are internally managed by the language and referenced via numeric values. VARIABLE NAMING RULES RULE: User-defined variable names: may contain letters and digits must NOT contain spaces must use underscore (_) to separate multiple words ALLOWED: punteggio centro_x velocità_massima FORBIDDEN: centro x velocità massima RULE: Predefined variables, predefined functions, and predefined constants use names composed of multiple words separated by spaces. RULE: This distinction is intentional and mandatory. VARIABLE MODIFICATION RULE: Variables may be reassigned at any time. RULE: Reassignment replaces the previous value. INCREMENT AND DECREMENT CONSTRUCTS RULE: Atomic provides dedicated constructs for modifying numeric variables. SYNTAX: aumenta di diminuisci di RULE: These constructs are equivalent to explicit arithmetic reassignment. VARIABLE USAGE RULE: Variables may be used in: arithmetic expressions logical comparisons function arguments dynamic text substitution VARIABLES IN EXPRESSIONS RULE: Variables may participate in mathematical expressions. RULE: Expressions may combine: variables constants numeric literals operators VARIABLES IN TEXT (DYNAMIC SUBSTITUTION) RULE: Variables may be embedded inside text using: RULE: The value is resolved at execution time. FORBIDDEN: function calls inside text expressions inside text nested substitutions PREDEFINED VARIABLES (GENERAL RULES) RULE: Atomic provides predefined variables that are always available. RULE: Predefined variables must NOT be declared. RULE: Some predefined variables are read-only. RULE: Some predefined variables are writable. RULE: Attempting to write to a read-only predefined variable is invalid. RULE: The complete predefined variable list is closed and defined in official reference files only. INPUT-RELATED PREDEFINED VARIABLES RULE: Mouse position variables exist: x del mouse y del mouse RULE: These variables are numeric and read-only. WINDOW-RELATED PREDEFINED VARIABLES RULE: Window dimension variables exist: larghezza finestra altezza finestra RULE: These variables are numeric and writable. RULE: Background color variable exists: colore sfondo RULE: Window title variable exists: nome finestra KEYBOARD AND MOUSE INPUT VARIABLES RULE: Keyboard input state variables exist in the form: tasto è stato premuto tasto è stato rilasciato tasto è premuto RULE: These variables: are numeric are read-only evaluate to true or false RULE: Mouse wheel input variables exist: rotella del mouse in su rotella del mouse in giu TIMER VARIABLES RULE: Atomic provides exactly eight timer variables: timer 1 through timer 8 RULE: Timer variables: are numeric decrease automatically by 1 every second may be manually reassigned RANDOM VARIABLES RULE: Atomic provides random value variables: x casuale y casuale angolo casuale RULE: Random variables are numeric and read-only. RULE: Random ranges are fixed: RULE: x casuale returns a numeric value between 0 and the window width. RULE: y casuale returns a numeric value between 0 and the window height. RULE: angolo casuale returns a numeric value between 0 and 360. VARIABLES AND CONDITIONS RULE: Variables may be used in conditional expressions. RULE: Conditional results are numeric. RULE: Boolean equivalence: vero == 1 falso == 0 RULE: Any numeric value < 0.5 is false. RULE: Any numeric value = 0.5 is true. VARIABLES AND ITERATIONS RULE: Variables may be used as counters or control values in iterations. RULE: Iteration-specific variables are defined in iteration reference files. VARIABLE SCOPE RULE: Variables defined in the main code scope are accessible: inside INIZIA inside CICLO CONTINUO inside iterations inside conditionals RULE: Inside element-context execution, element arguments behave as local variables. RULE: Element-local behavior is defined in the objects specification. VARIABLE EXISTENCE RULE RULE: A variable exists if and only if: it is a documented predefined variable OR it has been explicitly created by user assignment OR it is provided by a loaded extension (.dll) FORBIDDEN: Implicit or undeclared variables. LANGUAGE CLOSURE (VARIABLE SYSTEM) RULE: No variable exists outside the documented system. RULE: The variable system is closed.