#include <stdio.h>
#include <unistd.h>
#include "../core/face_node.h"
extern void face_bind_alpine(struct FaceNode* f);
static void show(const struct FaceNode* f){
  for(int r=0;r<f->rows;r++){ for(int c=0;c<f->cols;c++) putchar(f->surface[r*f->cols+c]); putchar('\n'); }
}
int main(void){
  struct FaceNode f = {0};
  face_bind_alpine(&f); face_realize(&f);
  for(int i=0;i<250;i++){ face_tick(&f); usleep(10000); }
  const char* cmd = "echo SUBSTRATE_FACE_PROOF=$(id -un):$(hostname)\n";
  for(const char* p=cmd; *p; ++p){ face_key(&f,(uint8_t)*p); usleep(5000); }
  for(int i=0;i<150;i++){ face_tick(&f); usleep(10000); }
  printf("== Alpine PROJECTION: live guest, typed command executed ==\n");
  show(&f);
  printf("coord(pid)=%u genome=%s\n", f.basis.coord(f.self), f.genome);
  return 0;
}
