Shufflerator now shuffles like the NL one does!
[clnl] / bin / runcmd.scala
index 916a56cbfaf4e4eb71743d47dc71b0f09c6e54ab..8afdc36a8ac9a26cc7d24f2a71e88016477f8a1d 100755 (executable)
@@ -1,8 +1,12 @@
 #!/bin/sh
-exec scalas "$0" "$@"
+exec scalas "$0" -q "$@"
 !#
 
 /***
+  logLevel := Level.Error
+
+  logLevel in Global := Level.Error
+
   scalaVersion := "2.10.3"
 
   libraryDependencies ++= Seq(
@@ -14,31 +18,20 @@ exec scalas "$0" "$@"
 */
 
 import org.nlogo.headless.HeadlessWorkspace
-import org.nlogo.mirror
 import org.nlogo.api
 import org.nlogo.nvm
 import org.nlogo.util.Utils.url2String
 
+System.out.println("----")
 val workspace = HeadlessWorkspace.newInstance
 workspace.silent = true
-workspace.openFromSource(url2String(api.ModelReader.emptyModelPath))
-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))
-mirror.Mirrorables.allMirrorables(workspace.world).map( x => {
-  System.out.print("(")
-  System.out.print(x.kind)
-  System.out.print(" ")
-  System.out.print(x.agentKey.id)
-  System.out.print(" (")
-  x.kind.Variables.values.toSeq.map( k => {
-    System.out.print("(" + k + " ")
-    x.getVariable(k.id) match {
-      case s: java.lang.String => System.out.print("\"s\"")
-      case v => System.out.print(v)
-    }
-    System.out.print(") ")
-  })
-  System.out.println(")")
-  
-  })
+workspace.openFromSource(url2String("file:resources/empty.nlogo"))
+
+val commands = io.Source.stdin.getLines.mkString("\n")
+
+workspace.mainRNG.setSeed(15)
+workspace.runCompiledCommands(new api.SimpleJobOwner("test", workspace.world.mainRNG, api.AgentKind.Observer), workspace.compileCommands(commands, api.AgentKind.Observer))
 
+workspace.world.exportWorld(new java.io.PrintWriter(System.out, true), true)
+System.out.println(org.nlogo.headless.Checksummer.calculateChecksum(workspace.world.exportWorld(_, true)))
 workspace.dispose