NetLogo / Tortoise

Compiler and runtime engine for NetLogo models that runs in JavaScript 🐢
https://netlogoweb.org
Other
56 stars 27 forks source link

Add Table Extension #220

Closed iloveivyxuan closed 4 years ago

iloveivyxuan commented 4 years ago

This PR is the table extension.

Following is the summary of what I've done in this PR

I didn't implement groupAgents() API. I got stuck on implementing it and would be appreciated if I can get an idea or information.

I've got some observations. I noticed that groupAgents() means to group agents by their attributes, like color, xcor, size... After I console.log(reporter), I found it's an anonymous function

() { return SelfManager.self().getVariable("color"); }

I guess SelfManager.self() need to be replaced by agent. But I don't know how. I was confused about how to write js to implement something like [color] of turtles.

Other Notes

I didn't add TableEquality tests that are about to compare extensions objects. I'd like to open a new PR to implement this feature on table, matrix, array ...

iloveivyxuan commented 4 years ago

Thank you so much for the detailed information and the tip for faster debugging! That helps a lot. I find I can run my function without running Galapagos. This saves a lot of time for me!

I've fixed the code. Sorry for the late commitments.

LaCuneta commented 4 years ago

Awesome, thanks again for all your work!