We program a way to observe the moving points. To do that we define a global signal to_draw on which points will send their states.

signal to_draw;;

Then we define a process called window which opens the graphical window and displays the points.

let process window =
  Graphics.open_graph "";
  loop
    await to_draw (all) in
    Graphics.clear_graph();
    List.iter
      (fun state ->
        let x, y = last ?state.pos in
        let x_int = (truncate x) mod (Graphics.size_x()) in
        let y_int = truncate y in
        Graphics.set_color state.color;
        Graphics.fill_circle x_int y_int 5)
      all
  end

#run window;;