package Ġmar ath ons . utils . at coder Ċ Ċ import Ġmar ath ons . utils .* Ċ import Ġjava . io .* Ċ import Ġjava . util . concurrent . Callable Ċ Ċ fun Ġmain ( solution : Ġ(( BufferedReader , ĠBuffered Writer ) Ġ-> ĠUnit )) Ġ{ Ċ ĉ val Ġseed Ġ= ĠEvalu ator ._ seed Ċ ĉ val Ġpadded Name Ġ= Ġseed . toString (). pad Start ( 4 , Ġ' 0 ') Ċ ĉ val Ġtools Dir Ġ= Ġsolution . java Class . packageName . replace (".", Ġ"/") Ġ+ Ġ"/ tools ~ " Ċ ĉ val Ġin FileName Ġ= Ġ"$ padded Name . txt " Ċ ĉ val Ġin File Ġ= ĠFile ("$ tools Dir / in ", Ġin FileName ) Ċ ĉ val Ġout FileName Ġ= Ġ"$ padded Name . out " Ċ ĉ val Ġout File Ġ= ĠFile ("$ tools Dir / out ", Ġout FileName ) Ċ ĉ val Ġimage FileName Ġ= Ġ"$ padded Name . svg " Ċ ĉ val Ġimage File Ġ= ĠFile ("$ tools Dir / img ", Ġimage FileName ) Ċ ĉ val Ġhardcoded Image FileName Ġ= Ġ" out . svg " Ċ ĉ val Ġhardcoded Image File Ġ= ĠFile ( tools Dir , Ġhardcoded Image FileName ) Ċ ĉ out File . parent File . mkdir s () Ċ ĉ image File . parent File . mkdir s () Ċ ĉ Evaluator ._ outcome Time Ġ= Ġ- System . currentTimeMillis () Ċ ĉ solution . invoke ( in File . buffered Reader (), Ġout File . buffered Writer ()) Ċ ĉ Evaluator ._ outcome Time Ġ+= ĠSystem . currentTimeMillis () Ċ ĉ val Ġcommand Ġ= Ġ" cargo Ġrun Ġ-- release Ġ-- bin Ġvis Ġin /$ padded Name . txt Ġout /$ padded Name . out " Ċ ĉ val Ġ( output , Ġerror ) Ġ= Ġexec ( command , Ġtools Dir ) Ċ ĉ val Ġscore Ġ= Ġoutput . toInt () Ċ ĉ hard coded Image File . rename To ( image File ) Ċ ĉ P ictures . write ( image File . path ) Ċ ĉ Evaluator ._ outcome Score Ġ= Ġscore . toDouble () Ċ ĉ Evaluator ._ outcome My Score Ġ= ĠEvalu ator ._ outcome Score Ċ ĉ if Ġ( score Ġ== Ġ 0 ) Ġ{ Ċĉ ĉ print ("\ t ĠScore Ġ= Ġ 0 Ġ!!! ") Ċĉ ĉ Evaluator ._ outcome Tro uble s . add ( error ) Ċ ĉ } Ċ } Ċ Ċ fun Ġexec ( command : ĠString , Ġdir : ĠString ): ĠPair < String , ĠString > Ġ{ Ċ ĉ val Ġprocess Builder Ġ= ĠProcess Builder (* command . split (" Ġ"). to Typed Array ()). directory ( File ( dir )) Ċ ĉ val Ġprocess Ġ= Ġprocess Builder . start () Ċ ĉ val Ġoutput Ġ= Ġprocess . inputStream . reader (). read Text (). trim () Ċ ĉ val Ġerror Ġ= Ġprocess . error Stream . reader (). read Lines (). join ToString (" Ġ") Ċ ĉ return ĠPair ( output , Ġerror ) Ċ } Ċ Ċ class ĠVisual izer ( val Ġsolution : Ġ(( BufferedReader , ĠBuffered Writer ) Ġ-> ĠUnit )) Ġ: ĠCallable < Void ?> Ġ{ Ċ ĉ override Ġfun Ġcall (): ĠVoid ? Ġ= Ġmain ( solution ). let Ġ{ Ġnull Ġ} Ċ } Ċ