916a56cbfaf4e4eb71743d47dc71b0f09c6e54ab
[clnl] / bin / runcmd.scala
1 #!/bin/sh
2 exec scalas "$0" "$@"
3 !#
4
5 /***
6   scalaVersion := "2.10.3"
7
8   libraryDependencies ++= Seq(
9     "asm" % "asm-all" % "3.3.1",
10     "org.picocontainer" % "picocontainer" % "2.13.6",
11     "org.nlogo" % "NetLogo" % "6.0.0-M3" from "http://ccl.northwestern.edu/devel/6.0.0-M3/NetLogo.jar",
12     "org.nlogo" % "NetLogoHeadless" % "6.0.0-M3" from "http://ccl.northwestern.edu/devel/6.0.0-M3/NetLogoHeadless.jar"
13   )
14 */
15
16 import org.nlogo.headless.HeadlessWorkspace
17 import org.nlogo.mirror
18 import org.nlogo.api
19 import org.nlogo.nvm
20 import org.nlogo.util.Utils.url2String
21
22 val workspace = HeadlessWorkspace.newInstance
23 workspace.silent = true
24 workspace.openFromSource(url2String(api.ModelReader.emptyModelPath))
25 workspace.runCompiledCommands(new api.SimpleJobOwner("test", workspace.world.mainRNG, api.AgentKind.Observer), workspace.compileCommands("resize-world -2 2 -2 2 crt 1", api.AgentKind.Observer))
26 mirror.Mirrorables.allMirrorables(workspace.world).map( x => {
27   System.out.print("(")
28   System.out.print(x.kind)
29   System.out.print(" ")
30   System.out.print(x.agentKey.id)
31   System.out.print(" (")
32   x.kind.Variables.values.toSeq.map( k => {
33     System.out.print("(" + k + " ")
34     x.getVariable(k.id) match {
35       case s: java.lang.String => System.out.print("\"s\"")
36       case v => System.out.print(v)
37     }
38     System.out.print(") ")
39   })
40   System.out.println(")")
41   
42   })
43
44 workspace.dispose