Replace the remaining .kry and C application sources with Ziran modules, move vendored dependencies to their current pointers, and add Ziran tests for the ported hosts and policies.
77 lines
2.4 KiB
Ziran
77 lines
2.4 KiB
Ziran
#import, file "../src/practices/patterns/patterns_session_rules.zi";
|
|
#import, file "../src/practices/patterns/patterns_rules.zi";
|
|
#import, file "../src/app/app_types.zi";
|
|
|
|
#program_export
|
|
Answer :: () -> s32 {
|
|
state: Patterns
|
|
state.preset = PATTERNS_PRESET_COHERENT
|
|
state.active = 1
|
|
state.duration_minutes = 1
|
|
state.phase = PATTERNS_PHASE_INHALE
|
|
if patterns_ratio_part(state, 0) != 5 ||
|
|
patterns_ratio_part(state, 1) != 0 ||
|
|
patterns_phase_remaining(state) != 5 { return 1 }
|
|
index: s32 = 0
|
|
while index < 4 {
|
|
step := patterns_advance_second(*state)
|
|
if step.cue != 0 || step.completed {
|
|
return 2
|
|
}
|
|
index += 1
|
|
}
|
|
if state.phase != PATTERNS_PHASE_INHALE ||
|
|
patterns_phase_remaining(state) != 1 { return 3 }
|
|
step := patterns_advance_second(*state)
|
|
if step.cue != 2 || state.phase != PATTERNS_PHASE_EXHALE ||
|
|
state.phase_second != 0 || state.elapsed_seconds != 5 { return 4 }
|
|
index = 0
|
|
while index < 4 {
|
|
unused patterns_advance_second(*state)
|
|
index += 1
|
|
}
|
|
step = patterns_advance_second(*state)
|
|
if step.cue != 1 || state.phase != PATTERNS_PHASE_INHALE ||
|
|
state.cycle != 1 || state.elapsed_seconds != 10 { return 5 }
|
|
|
|
state.preset = PATTERNS_PRESET_CUSTOM
|
|
state.custom[0] = -4
|
|
state.custom[1] = 90
|
|
state.custom[2] = 0
|
|
state.custom[3] = 0
|
|
if patterns_ratio_part(state, 0) != 0 ||
|
|
patterns_ratio_part(state, 1) != 60 { return 6 }
|
|
state.custom[1] = 0
|
|
step = patterns_advance_second(*state)
|
|
if state.elapsed_seconds != 10 || step.completed {
|
|
return 7
|
|
}
|
|
state.active = 0
|
|
state.preset = PATTERNS_PRESET_BOX
|
|
step = patterns_advance_second(*state)
|
|
if state.elapsed_seconds != 10 || step.cue != 0 {
|
|
return 8
|
|
}
|
|
|
|
state.active = 1
|
|
state.elapsed_seconds = 59
|
|
state.phase = PATTERNS_PHASE_INHALE
|
|
state.phase_second = 0
|
|
step = patterns_advance_second(*state)
|
|
if !step.completed || state.elapsed_seconds != 60 {
|
|
return 9
|
|
}
|
|
app: InnerBreeze
|
|
app.patterns = state
|
|
app.patterns.preset = PATTERNS_PRESET_478
|
|
app.patterns.phase = PATTERNS_PHASE_HOLD_IN
|
|
app.patterns.phase_second = 2
|
|
ratio: [4]s32
|
|
pattern_ratio(*app, *ratio[0])
|
|
if ratio[0] != 4 || ratio[1] != 7 || ratio[2] != 8 ||
|
|
ratio[3] != 0 || patterns_phase_remaining_seconds(*app) != 5 {
|
|
return 10
|
|
}
|
|
return 42
|
|
}
|