X-Git-Url: https://code.consxy.com/gitweb/gitweb.cgi?p=clnl;a=blobdiff_plain;f=bin%2Fruncmd.scala;h=f85ee7e61541d53b07cc5ba7ca82fd924903f9c5;hp=90a1d4d25a5e16dc14311680cf3bd43410149b61;hb=daa3b99095a3219506e930c7dd684bfbab4cf107;hpb=aac9bb31ffb4acb49bc2a8eacc8175d5314acf0a diff --git a/bin/runcmd.scala b/bin/runcmd.scala index 90a1d4d..f85ee7e 100755 --- a/bin/runcmd.scala +++ b/bin/runcmd.scala @@ -28,10 +28,17 @@ val workspace = HeadlessWorkspace.newInstance workspace.silent = true workspace.openFromSource(url2String("file:resources/empty.nlogo")) -val commands = io.Source.stdin.getLines.mkString("\n") +val input = io.Source.stdin.getLines.mkString("\n").split("\\@\\#\\$\\#\\@\\#\\$\\#\\@") +val commands = input(0) workspace.mainRNG.setSeed(15) -workspace.runCompiledCommands(new api.SimpleJobOwner("test", workspace.world.mainRNG, api.AgentKind.Observer), workspace.compileCommands(commands, api.AgentKind.Observer)) +if(commands.length > 0) { + workspace.runCompiledCommands(new api.SimpleJobOwner("test", workspace.world.mainRNG, api.AgentKind.Observer), workspace.compileCommands(commands, api.AgentKind.Observer)) +} +if(input.length > 0) { + val reporter = input(1) + System.out.println(org.nlogo.api.Dump.logoObject(workspace.runCompiledReporter(new api.SimpleJobOwner("test", workspace.world.mainRNG, api.AgentKind.Observer), workspace.compileReporter(reporter)))) +} workspace.world.exportWorld(new java.io.PrintWriter(System.out, true), true) System.out.println(org.nlogo.headless.Checksummer.calculateChecksum(workspace.world.exportWorld(_, true)))