2 exec scalas "$0" -q "$@"
6 logLevel := Level.Error
8 logLevel in Global := Level.Error
10 scalaVersion := "2.10.3"
12 libraryDependencies ++= Seq(
13 "asm" % "asm-all" % "3.3.1",
14 "org.picocontainer" % "picocontainer" % "2.13.6",
15 "org.nlogo" % "NetLogoHeadless" % "6.0.0-M3" from "http://ccl.northwestern.edu/devel/6.0.0-M3/NetLogoHeadless.jar"
19 import org.nlogo.headless.HeadlessWorkspace
22 import org.nlogo.util.Utils.url2String
24 import collection.JavaConversions._
26 System.out.println("----")
27 val workspace = HeadlessWorkspace.newInstance
28 workspace.silent = true
29 workspace.openFromSource(url2String("file:resources/empty.nlogo"))
31 val input = io.Source.stdin.getLines.mkString("\n").split("\\@\\#\\$\\#\\@\\#\\$\\#\\@")
32 val commands = input(0)
34 workspace.mainRNG.setSeed(15)
35 if(commands.length > 0) {
36 workspace.runCompiledCommands(new api.SimpleJobOwner("test", workspace.world.mainRNG, api.AgentKind.Observer), workspace.compileCommands(commands, api.AgentKind.Observer))
38 if(input.length > 1) {
39 val reporter = input(1)
40 System.out.println(org.nlogo.api.Dump.logoObject(workspace.runCompiledReporter(new api.SimpleJobOwner("test", workspace.world.mainRNG, api.AgentKind.Observer), workspace.compileReporter(reporter))))
43 workspace.world.exportWorld(new java.io.PrintWriter(System.out, true), true)
44 System.out.println(org.nlogo.headless.Checksummer.calculateChecksum(workspace.world.exportWorld(_, true)))