Prims - Implement =
[clnl] / bin / runreporter.scala
1 #!/bin/sh
2 exec scalas "$0" -q "$@"
3 !#
4
5 /***
6   logLevel := Level.Error
7
8   logLevel in Global := Level.Error
9
10   scalaVersion := "2.10.3"
11
12   libraryDependencies ++= Seq(
13     "asm" % "asm-all" % "3.3.1",
14     "org.picocontainer" % "picocontainer" % "2.13.6",
15     "org.nlogo" % "NetLogo" % "6.0.0-M3" from "http://ccl.northwestern.edu/devel/6.0.0-M3/NetLogo.jar",
16     "org.nlogo" % "NetLogoHeadless" % "6.0.0-M3" from "http://ccl.northwestern.edu/devel/6.0.0-M3/NetLogoHeadless.jar"
17   )
18 */
19
20 import org.nlogo.headless.HeadlessWorkspace
21 import org.nlogo.mirror
22 import org.nlogo.api
23 import org.nlogo.nvm
24 import org.nlogo.util.Utils.url2String
25
26 System.out.println("----")
27 val workspace = HeadlessWorkspace.newInstance
28 workspace.silent = true
29 workspace.openFromSource(url2String("file:resources/empty.nlogo"))
30
31 val reporter = io.Source.stdin.getLines.mkString("\n")
32
33 workspace.mainRNG.setSeed(15)
34 System.out.println(org.nlogo.api.Dump.logoObject(workspace.runCompiledReporter(new api.SimpleJobOwner("test", workspace.world.mainRNG, api.AgentKind.Observer), workspace.compileReporter(reporter))))
35
36 workspace.world.exportWorld(new java.io.PrintWriter(System.out, true), true)
37 System.out.println(org.nlogo.headless.Checksummer.calculateChecksum(workspace.world.exportWorld(_, true)))
38 workspace.dispose