Hi Jeremy 

Thank you so much for your very detailed answer. The use case I am working 
on is closest to #3. 

I had been looking on Galapagos and Teletortoise (which I know is 
discontinued) to see if I could come up with how to use tortoise. 

However your instructions was really helpful. I am going to try them out, 
and see how it goes.

Thank you :) 

//Daniel

On Tuesday, 2 July 2019 23:44:53 UTC+2, Jeremy Baker wrote:
>
> Hey Daniel!  Welcome.
>
> The answer here really depends on what you're trying to use Tortoise for, 
> but I tried to cover the possibilities below.  If I missed you're use case, 
> just let me know and I'll try to fill in more details.
>
> 0) The first thing I'd point out is that Tortoise is just the compiler and 
> engine for NetLogo Web, it doesn't include any front-end UI or view code. 
>  For that, there is Galapagos, which gives a UI for loading models and also 
> runs models, updating a view for them while they go:  
> https://github.com/NetLogo/Galapagos.  If you want to make changes to 
> Tortoise and see those in a front-end, check out the instructions in the 
> Galapagos repo for that:  
> https://github.com/NetLogo/Galapagos/wiki/Contributing#publishing-tortoise-changes
>
> 1) If you're trying to make changes to the Tortoise code to do things like 
> adding features or changing existing primitives, you're probably best 
> served using the tests built into Tortoise in order to "use" it.  You can 
> take a look at `Tortoise.txt` to see how add simple NetLogo language tests, 
> or `Model.scala` to add a whole model for testing if you prefer to test 
> that way.  More info on tests:  
> https://github.com/NetLogo/Tortoise/wiki/Tortoise-Tests
>
> 2) If you're trying to compile and run models headless-ly, then I'd 
> recommend using NetLogo desktop, as it's probably going to be better for 
> that purpose than Tortoise, especially with BehaviorSpace.
>
> 3) If you're trying to build your own UI around Tortoise from within 
> Javascript (or just want to play with it), then the best reference will 
> probably be the Galapagos project code.  The short steps to using the 
> Tortoise compiler and engine from a Javascript runtime (a web page loaded 
> in a browser, Node.js):
>
>
>    - Get the `tortoise-engine.js` and `tortoise-compiler.js` files 
>    added/loaded to your environment.  If you run `netLogoWeb/package` from 
>    within sbt, you'll get a copy of those in the `netlogo-web/target/classes` 
>    folder to copy off.
>    - Run `var compiler = new BrowserCompiler()` to get a compiler 
>    instance to use with NetLogo model code.
>    - Run `var compilation = compiler.fromNlogo(nlogo, [])` where `nlogo` 
>    is a string with your NetLogo model code, as if from an `.nlogo` file. 
>     There are other methods exposed on `BrowserCompiler` as well:  
>    
> https://github.com/NetLogo/Tortoise/blob/master/compiler/js/src/main/scala/BrowserCompiler.scala
>    - Now `compilation` should have some data like `{ model: { success: 
>    true, result: jsCode }, widgets: widgetJSONArray }` (assuming success).
>    - You can then use that `compilation.model.result` along with `eval()` 
>    to load the generated model Javascript for execution.
>    - Feel free to check out the `compilation.model.result` to see what 
>       the generated Javascript for a model looks like.  That will help know 
> what 
>       you can do with it.
>       - The procedures from the model will be placed in a `procedures` 
>       object in the global context (or the context you `eval()` in, really), 
> so 
>       you can then do things like `procedures["SETUP"]` or `procedures["GO"]`.
>       - You'll also have a `world` object with some interesting 
>       properties, like `world.observer.varNames()` and also a `workspace` 
> with 
>       objects and functions needed for the engine to run.
>    
>
> That doesn't get you a view or usable widgets or anything like that (see 
> item #0), but will get you a model you can run or mess around with a bit. 
>
> I hope that helps!
>
> -Jeremy
>
> On Tuesday, July 2, 2019 at 9:28:32 AM UTC-5, Daniel Graungaard wrote:
>>
>> Hi everybody!
>>
>> I have been trying to get Tortoise to run on my own machine for a couple 
>> of days. My plan is to try and use it for a reserach experiment on 
>> collaborative computing and CT, so I really need to be able to run it on my 
>> own machine /server. As I really want NetLogo to be part of this, Tortoise 
>> seemed very promising.
>>
>> I have tried multiple things, including figuring out which version of 
>> GraalVM is used, and can now compile everything without errors. 
>>
>> However, I have no overview of the project, and no idea about how to 
>> actually run the thing. I have been looking for an explanation both in here 
>> and in the different repos without luck.
>>
>> Can somebody provide me with a quick intro into how to actually run 
>> Tortoise, or point me in the direction of a ressource with an explanation? 
>>
>> I have prior experience with java and Nodejs, so I am not looking for a 
>> complete tutorial, developement guide or documentation. Just some quick 
>> pointers to get over the initial confusion.
>>
>> Really hopes anybody can help me.
>>
>> //Daniel
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"netlogo-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to netlogo-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/netlogo-devel/50de9a6f-ec73-4911-92e3-6774a3d1f062%40googlegroups.com.

Reply via email to