#!/usr/bin/env bash
# Lab gameplay synth pilot on chain hop .250 (adjacent Master pos3).
# Runs debug bridge in background with log; stop with: sudo systemctl start fixture-prod
set -euo pipefail
cd ~/EtherGold/dev
export FIXTURE_POS="${FIXTURE_POS:-1}"
export PI_LABEL="${PI_LABEL:-topbox250}"
export CHANNEL="${CHANNEL:-machine}"
export CLEAR_CAPTURE="${CLEAR_CAPTURE:-1}"
export LAB_GAMEPLAY_SYNTH=1
export LAB_GAMEPLAY_TID="${LAB_GAMEPLAY_TID:-E001}"
export LAB_GAMEPLAY_GAMES="${LAB_GAMEPLAY_GAMES:-touch6,superpick,bingo,poker,keno,spinjack,triple7s}"
export LAB_GAMEPLAY_SESSION_S=300
export LAB_GAMEPLAY_SESSION_S=300
export LAB_GAMEPLAY_PERIOD_S=3
export LAB_GAMEPLAY_JITTER_S=0.5
export LAB_GAMEPLAY_TOUCH6_REPLICATE=1
export LAB_GAMEPLAY_SYNTH_ALLOW_PROD=0
export FIXTURE_PROD=0
export FIXTURE_DEV_LIGHT=1
mkdir -p ~/EtherGold/logs/lab_gameplay_pilot
LOG=~/EtherGold/logs/lab_gameplay_pilot/bridge.log
# Prefer nohup for agent-started pilot (operator can attach via tail -f)
nohup bash run_bridge_jun11_good.sh >"$LOG" 2>&1 &
echo $! >~/EtherGold/logs/lab_gameplay_pilot/bridge.pid
sleep 4
echo "pid=$(cat ~/EtherGold/logs/lab_gameplay_pilot/bridge.pid)"
tail -40 "$LOG" || true
pgrep -af 'pog422_fixture_bridge|lab_gameplay' | head -5 || true
