Hey guys

Seems like I am getting some stuff to work and getting an overview of 
Tortoise in general. I have on more question however:

How do I specify a canvas for the engine to draw on? 

Do you have some code from Galapagos or an other source showing this? 

//Daniel

On Thursday, 4 July 2019 14:14:21 UTC+2, Daniel Graungaard wrote:
>
> Hello Jason and Jeremy
>
> Thanks so much for your very helpful and detailed replies!
>
> Very useful to get an overview of the architecture and pointers to both 
> Galapagos and Tortoise. 
>
> I'm currently playing a bit more around and making slow progress in my 
> project. 
>
> //Daniel
>
> On Wednesday, 3 July 2019 15:37:34 UTC+2, Jason Bertsche wrote:
>>
>> Your `nlogo` variable needs to contain the string form of a valid NetLogo 
>> model file (i.e. a '.nlogo' file).  In order to compile code into something 
>> useful, NetLogo needs a lot more information than just your procedures 
>> (e.g. it needs to know if there are any global variables that are declared 
>> in widgets).
>>
>> To make this example of yours work, just get ahold of a '.nlogo' file for 
>> a blank model in either NetLogo or NetLogo Web.  '.nlogo' files are text 
>> files that are delimited by instances of @#$#@#$#@ .  Add the code for 
>> your NetLogo procedures before the first instance of the delimiter.  Then, 
>> copy the entire contents of that file as the value for your `nlogo` 
>> variable in your JavaScript program, and it should work.
>>
>> On 7/3/2019 6:06 AM, Daniel Graungaard wrote:
>>
>> The answer provided in #3 was exactly what I was looking for. Thanks so 
>> much for that. 
>>
>> However I keep getting "success false", with the message: "Models must 
>> have 12 sections, this had 1". 
>>
>> I have looked through both test and code from Galapagos, and have tried 
>> different values for the nlogo string. However I keep getting the error.
>>
>> Do you have any idea why or can you provide the format for the nlogo 
>> string? 
>>
>> I have attached screenshots of my code and outputs below. 
>>
>> //Daniel
>>
>>
>>
>> On Wednesday, 3 July 2019 08:40:27 UTC+2, Daniel Graungaard wrote: 
>>>
>>> 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 
>>>> <https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_NetLogo_Galapagos&d=DwMFaQ&c=yHlS04HhBraes5BQ9ueu5zKhE7rtNXt_d012z2PA6ws&r=sxGjFFyk2A6rYHwAdDtnqeTKj3cEcXDGDo_G9va2ruI&m=9m7nuws8obuQj3KVSXKYEe9xN-izRLAG48QZbKMCzVk&s=Z1bdlUpDKPcq5Oe3U9PCl0GS-R3ahfALHIRHg45Mg3w&e=>.
>>>>  
>>>>  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
>>>>  
>>>> <https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_NetLogo_Galapagos_wiki_Contributing-23publishing-2Dtortoise-2Dchanges&d=DwMFaQ&c=yHlS04HhBraes5BQ9ueu5zKhE7rtNXt_d012z2PA6ws&r=sxGjFFyk2A6rYHwAdDtnqeTKj3cEcXDGDo_G9va2ruI&m=9m7nuws8obuQj3KVSXKYEe9xN-izRLAG48QZbKMCzVk&s=bcCJ1ZmUZUwmUc-_BQRNRgeSSBSxWa1w0Q35L2gax-Y&e=>
>>>>
>>>> 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 
>>>> <https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_NetLogo_Tortoise_wiki_Tortoise-2DTests&d=DwMFaQ&c=yHlS04HhBraes5BQ9ueu5zKhE7rtNXt_d012z2PA6ws&r=sxGjFFyk2A6rYHwAdDtnqeTKj3cEcXDGDo_G9va2ruI&m=9m7nuws8obuQj3KVSXKYEe9xN-izRLAG48QZbKMCzVk&s=ACgyvolNMZIoG6uMtDvFwNJRUiQFTrh-EfMvtn7-F7E&e=>
>>>>
>>>> 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
>>>>  
>>>>    
>>>> <https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_NetLogo_Tortoise_blob_master_compiler_js_src_main_scala_BrowserCompiler.scala&d=DwMFaQ&c=yHlS04HhBraes5BQ9ueu5zKhE7rtNXt_d012z2PA6ws&r=sxGjFFyk2A6rYHwAdDtnqeTKj3cEcXDGDo_G9va2ruI&m=9m7nuws8obuQj3KVSXKYEe9xN-izRLAG48QZbKMCzVk&s=XrENAwyJW_WinT39cMKVhENq5MchLbdzoLmi1f2C2tU&e=>
>>>>    - 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 netlog...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/netlogo-devel/bbf2bf2a-d4c2-425b-b523-02b68b95faaa%40googlegroups.com
>>  
>> <https://urldefense.proofpoint.com/v2/url?u=https-3A__groups.google.com_d_msgid_netlogo-2Ddevel_bbf2bf2a-2Dd4c2-2D425b-2Db523-2D02b68b95faaa-2540googlegroups.com-3Futm-5Fmedium-3Demail-26utm-5Fsource-3Dfooter&d=DwMFaQ&c=yHlS04HhBraes5BQ9ueu5zKhE7rtNXt_d012z2PA6ws&r=sxGjFFyk2A6rYHwAdDtnqeTKj3cEcXDGDo_G9va2ruI&m=9m7nuws8obuQj3KVSXKYEe9xN-izRLAG48QZbKMCzVk&s=Ru1HyD3jgWUg87uub7_wMpklIM-srMoi9hmWf0CxeaM&e=>
>> .
>>
>>
>>

-- 
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/2e74e09d-cbd5-4463-8abd-7a6e43acaaa2%40googlegroups.com.

Reply via email to