Phase 4a: machine states auto-number by declaration order

state KnightMenu = 0 { }  ->  state KnightMenu { }. Machine states now take their
value from declaration order (0,1,2,...); an explicit 'state Name = expr' still
works for the rare non-ordinal case. Removes the magic constants from state
machines (finding #13). Migrated combat.ludic's battle machine; chronorift golden
byte-identical (the ordinals match the old explicit 0-4). Reseeded, fixpoint
holds, test.sh 14/14.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-08-27 16:20:34 +03:00
parent 9a558d6b58
commit fd0b890acc
4 changed files with 427 additions and 394 deletions

View file

@ -9,7 +9,7 @@ system Battle phase Update {
for (e) in query [Stats, {Enemy}] {
machine R_PHASE {
state KnightMenu = 0 {
state KnightMenu {
for (st, pt) in query [Stats, Party] {
if pt.slot == 0 {
if st.hp <= 0 {
@ -46,7 +46,7 @@ system Battle phase Update {
}
}
state KnightResolve = 1 {
state KnightResolve {
if k != 0 {
if e.hp <= 0 {
grant_xp(e.xp)
@ -61,7 +61,7 @@ system Battle phase Update {
}
}
state MageMenu = 2 {
state MageMenu {
for (st, pt) in query [Stats, Party] {
if pt.slot == 1 {
if st.hp <= 0 {
@ -95,7 +95,7 @@ system Battle phase Update {
}
}
state MageResolve = 3 {
state MageResolve {
if k != 0 {
if e.hp <= 0 {
grant_xp(e.xp)
@ -109,7 +109,7 @@ system Battle phase Update {
}
}
state EnemyTurn = 4 {
state EnemyTurn {
if k != 0 {
let done = 0
for (t3) in query [Stats, {Party}] {