i tried chatgpt and it was [gaslighting] like perplexity so i
told;perplexitu to use;claude, might be doing better
i got into a context where it's actually implementing;the
faster-than-light teleportation concept, it says the attached draft
functions as;a very very simple example, and that if zksnarks are
used;remote parties don't need to know agent information to predict
when they decide to blink in
/*
* ftlblink.c — minimal FTL teleportation simulation
*
* Microuniverse: N independent xorshift32 streams (deterministic PRNG sequences)
* Agents: private rule derived from secret seed, locality to one stream,
* publish only a commitment hash — rule never exposed
* Teleport: fires when agent's private rule matches stream value AND
* mutual prediction confidence threshold is met
*
* compile: gcc -O2 -o ftlblink ftlblink.c
*/
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
/* ---------- configuration ---------- */
#define N_STREAMS 6
#define N_AGENTS 4
#define N_TICKS 24
#define TELEPORT_THRESHOLD 0.55f /* min prediction confidence to authorize teleport */
#define CONF_ALPHA 0.25f /* EMA smoothing for confidence update */
/* ---------- stream (xorshift32 PRNG) ---------- */
typedef struct { uint32_t s; } Stream;
static uint32_t stream_next(Stream *st) {
st->s ^= st->s << 13;
st->s ^= st->s >> 17;
st->s ^= st->s << 5;
return st->s;
}
/* peek ahead k steps without mutating — clone-and-advance */
static uint32_t stream_peek(Stream st, int k) {
for (int i = 0; i < k; i++) stream_next(&st);
return st.s;
}
/* ---------- private rule ----------
* Each agent holds one of these. Never printed, never serialised.
* Only the commitment hash is public.
*/
typedef struct {
uint32_t mod; /* watch for val % mod == target */
uint32_t target;
float eagerness; /* 0..1: how readily agent attempts teleport */
} Rule;
/* commitment: djb2 mix of rule fields — stands in for a real hash/ZKP */
static uint32_t commit(const Rule *r) {
uint32_t h = 5381;
h = ((h << 5) + h) ^ r->mod;
h = ((h << 5) + h) ^ r->target;
/* eagerness is kept fully private — not even committed to */
return h;
}
/* ---------- agent ---------- */
typedef struct {
uint32_t id;
int stream_idx; /* public: which stream agent currently inhabits */
uint32_t commitment; /* public: hash of private rule */
float conf; /* public: running prediction confidence */
/* -- private below -- */
Rule rule; /* private rule, derived from secret seed */
uint32_t last_val; /* last observed stream value */
int n_teleports; /* stats */
} Agent;
/* instantiation: private_seed never leaves this function's scope in a real system */
static Agent agent_new(uint32_t id, int stream_idx, uint32_t private_seed) {
Agent a;
memset(&a, 0, sizeof a);
a.id = id;
a.stream_idx = stream_idx;
/* derive private rule from seed */
Stream rng = { private_seed };
a.rule.mod = (stream_next(&rng) % 7) + 2; /* 2..8 */
a.rule.target = stream_next(&rng) % a.rule.mod;
a.rule.eagerness = (float)(stream_next(&rng) >> 8) / (float)(1 << 24);
a.commitment = commit(&a.rule);
return a;
}
/* observe current stream value; update confidence EMA */
static void agent_observe(Agent *a, uint32_t val) {
a->last_val = val;
float hit = (val % a->rule.mod == a->rule.target) ? 1.0f : 0.0f;
a->conf = (1.0f - CONF_ALPHA) * a->conf + CONF_ALPHA * hit;
}
/* returns target stream index, or -1 if no teleport desired */
static int agent_want_teleport(const Agent *a, int n_streams) {
if (a->last_val % a->rule.mod != a->rule.target) return -1;
if (a->rule.eagerness < 0.25f) return -1;
/* pick destination: deterministic from last value, but different stream */
return (a->stream_idx + 1 + (int)(a->last_val % (uint32_t)(n_streams - 1)))
% n_streams;
}
/* attempt teleport; returns 1 on success
* authorisation: at least one peer on target stream has conf >= threshold,
* OR agent's own conf is sufficient (solo blink) */
static int agent_try_teleport(Agent *a, int target,
const Agent *all, int n_all) {
/* check for a sufficiently predictive peer on target stream */
for (int i = 0; i < n_all; i++) {
if (i == (int)a->id) continue;
if (all[i].stream_idx == target &&
all[i].conf >= TELEPORT_THRESHOLD) {
printf(" [TELEPORT] agent %u %d->%d (peer %u conf=%.2f)\n",
a->id, a->stream_idx, target,
all[i].id, all[i].conf);
a->stream_idx = target;
a->n_teleports++;
return 1;
}
}
/* solo blink: only own confidence */
if (a->conf >= TELEPORT_THRESHOLD) {
printf(" [BLINK] agent %u %d->%d (solo conf=%.2f)\n",
a->id, a->stream_idx, target, a->conf);
a->stream_idx = target;
a->n_teleports++;
return 1;
}
return 0;
}
/* ---------- main ---------- */
int main(void) {
srand((unsigned)time(NULL));
/* initialise streams */
Stream streams[N_STREAMS];
printf("=== ftlblink streams=%d agents=%d ticks=%d ===\n\n",
N_STREAMS, N_AGENTS, N_TICKS);
printf("streams (seeds):\n");
for (int i = 0; i < N_STREAMS; i++) {
streams[i].s = (uint32_t)(rand() | 1);
printf(" [%d] seed=0x%08x\n", i, streams[i].s);
}
printf("\n");
/* instantiate agents
* private_seed is chosen locally; in a real system it would never be
* transmitted — only the commitment (hash) is published */
Agent agents[N_AGENTS];
printf("agents (public info only):\n");
for (int i = 0; i < N_AGENTS; i++) {
uint32_t private_seed = (uint32_t)rand();
agents[i] = agent_new((uint32_t)i, i % N_STREAMS, private_seed);
printf(" agent %u stream=%d commit=0x%08x "
"(rule: private)\n",
agents[i].id, agents[i].stream_idx, agents[i].commitment);
}
printf("\n");
/* tick loop */
for (int t = 0; t < N_TICKS; t++) {
printf("--- tick %-3d ---\n", t);
/* advance all streams */
uint32_t vals[N_STREAMS];
for (int i = 0; i < N_STREAMS; i++)
vals[i] = stream_next(&streams[i]);
/* each agent observes its local stream value */
for (int i = 0; i < N_AGENTS; i++)
agent_observe(&agents[i], vals[agents[i].stream_idx]);
/* each agent independently decides and attempts teleport */
for (int i = 0; i < N_AGENTS; i++) {
int target = agent_want_teleport(&agents[i], N_STREAMS);
if (target >= 0)
agent_try_teleport(&agents[i], target, agents, N_AGENTS);
}
/* print public state */
for (int i = 0; i < N_AGENTS; i++) {
printf(" agent[%u] stream=%d conf=%.2f val=%-10u "
"teleports=%d\n",
agents[i].id, agents[i].stream_idx,
agents[i].conf, agents[i].last_val,
agents[i].n_teleports);
}
}
/* summary */
printf("\n=== summary ===\n");
for (int i = 0; i < N_AGENTS; i++)
printf(" agent %u final_stream=%d teleports=%d conf=%.2f\n",
agents[i].id, agents[i].stream_idx,
agents[i].n_teleports, agents[i].conf);
return 0;
}