diff --git a/eternal/demonic-tutor.sml b/eternal/demonic-tutor.sml index 7df60b1..4e6e9e6 100644 --- a/eternal/demonic-tutor.sml +++ b/eternal/demonic-tutor.sml @@ -51,17 +51,28 @@ fun mkOutstream out_file_desc = chunkSize = 1024, appendMode = true}, IO.NO_BUF)) +val isColon = fn x => x = #":" +val enhypenate = fn x => String.concatWith "-" (String.tokens isColon x) + fun mkStatstream player0 player1 tag = let - val player0 = - String.concatWith "-" (String.tokens (fn x => x = #":") player0) - val player1 = - String.concatWith "-" (String.tokens (fn x => x = #":") player1) + val player0 = enhypenate player0 + val player1 = enhypenate player1 val filename = "graph-" ^ player0 ^ "-" ^ player1 ^ "-" ^ tag ^ ".dat" in if !flagLogStats then SOME (TextIO.openOut filename) else NONE end +fun goGraph player0 player1 = + if not (!flagLogStats andalso !Make.flagSubmit) then () else + case String.tokens isColon player0 @ String.tokens isColon player1 of + l as [ p0, r0, p1, r1 ] => + if Make.file_exists ("graph-" ^ String.concatWith "-" l ^ ".png") + then () else + ignore (OS.Process.system("./submitgraph " ^ String.concatWith " " l)) + | _ => () + + fun setupPlayer player arg state statstream = let val exe = Make.getExe player @@ -254,6 +265,7 @@ fun match player0 player1 = val tok = String.tokens (fn c => c = #":") in (* Potentially record output *) + goGraph player0 player1; if not (!flagReport) then () else case (tok player0, tok player1) of ([ name0, rev0 ], [ name1, rev1 ]) => diff --git a/eternal/make.sml b/eternal/make.sml index 6b1c565..b7e2e47 100644 --- a/eternal/make.sml +++ b/eternal/make.sml @@ -5,6 +5,10 @@ structure Make:> sig * a path to player-hopeless.exe or player-hopeless-102.exe *) val getExe: string -> string exception MakeFailed + + (* breaking interfaces *) + val flagSubmit: bool ref + val file_exists: string -> bool end = struct val flagSubmit = Params.flag false diff --git a/submitgraph b/submitgraph index 0267496..cc3c32c 100755 --- a/submitgraph +++ b/submitgraph @@ -2,6 +2,6 @@ file=graph-$1-$2-$3-$4 -gnuplot -e "set terminal png; set output '$file.png'; plot '$file-0.dat' ti 'Player 0: $1:$2' with impulses, '$file-1.dat' ti 'Player1: $3:$4' with impulses" +gnuplot -e "set terminal png; set output '$file.png'; plot '$file-0.dat' ti 'Player 0: $1:$2' with impulses, '$file-1.dat' ti 'Player 1: $3:$4' with impulses" scp $file.png R_E_D_A_C_T_E_D:/home/www/www/graphs/$1-$2-$3-$4.png \ No newline at end of file