Skip to content

Commit

Permalink
Look at all the pretty submission
Browse files Browse the repository at this point in the history
git-svn-id: svn://R_E_D_A_C_T_E_D/icfp/hw12@371 b3d0796d-73f4-44f3-a614-c7306c265f62
  • Loading branch information
rjsimmon committed Jun 19, 2011
1 parent 5f195af commit 36077a3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
20 changes: 16 additions & 4 deletions eternal/demonic-tutor.sml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 ]) =>
Expand Down
4 changes: 4 additions & 0 deletions eternal/make.sml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion submitgraph
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 36077a3

Please sign in to comment.