Create bbcr.py

This commit is contained in:
PSBigBig 2025-06-10 17:28:44 +08:00 committed by GitHub
parent 705d6b7db2
commit b255ac7c4c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

14
wfgy_sdk/bbcr.py Normal file
View file

@ -0,0 +1,14 @@
def check_collapse(B, Bc=1.2):
"""If residue exceeds threshold, trigger reset"""
return B > Bc
def reset_state(state, delta_B):
print("Reset triggered. Reinitializing state.")
return state * 0.0 + delta_B
def run_demo():
state = 3.0
B = 1.5
if check_collapse(B):
state = reset_state(state, delta_B=0.1)
print(f"Post-reset state: {state}")