Skip to content
Snippets Groups Projects
state.ml 535 B
Newer Older

open Algo

type t = {
  pid:string;
  input:int;
  sub:int;
  res:int
}

let (_to_string: (t -> string)) =
  fun s ->
    Printf.sprintf "input=%d sub=%d res=%d"  s.input s.sub s.res

erwan's avatar
erwan committed
let (to_string: (t -> string)) =
  fun s ->
    Printf.sprintf "{pid=%s ; input=%d}" s.pid  s.input


let of_string: (string -> t) option =
  Some (fun s ->
        Scanf.sscanf s "{pid=%s ; input=%d}"
          (fun pid input -> {pid = pid; input = input; sub = 0; res = 0})
    )

let (copy : ('v -> 'v)) = fun x -> x
let actions = ["S";"Rr";"Rp"]