#include <stdio.h>
#include "phi_lattice.h"
int main(void){
  uint32_t lat[PHI_LATTICE_SLOTS];
  uint64_t tick = 0;
  int n;
  for(int i=0;i<PHI_LATTICE_SLOTS;i++)
    lat[i] = (i % 2 == 0) ? 0x00000100u : 0xFFFF0000u;   // maximally divergent seed
  for(n=0;n<400;n++){
    phi_lattice_tick(lat, &tick);
    int locked = phi_lattice_consensus(lat);
    int show = 0;
    if(n<5) show = 1;
    if(n%50==0) show = 1;
    if(locked) show = 1;
    if(show) printf("tick %3d: lock=%d slot0=%u slot1=%u\n", n, locked, lat[0], lat[1]);
    if(locked) break;
  }
  return 0;
}
