agentscript0 icon indicating copy to clipboard operation
agentscript0 copied to clipboard

o Added a heatbugs-like JavaScript model

Open gepr opened this issue 11 years ago • 7 comments

I don't know if you're interested in this. But the sketches/jsmodel.html didn't go quite far enough for me. My playing around lead me to this model and I thought it might be helpful for others.

gepr avatar Oct 09 '14 10:10 gepr

OK, nice to have a new JS model. One change I'd like is to use our new object initializer for model: model = new ABM.Model({ div: "model", size: 4, minX: 1, maxX: 256, minY: 1, maxY: 192 }); We're going to drop the older multi-argument Model initializer shortly.

BTW: Any insights into using JS with a CS class? Hopefully es6 will bring all this back together.

-- Owen

On Thu, Oct 9, 2014 at 4:58 AM, gepr [email protected] wrote:

I don't know if you're interested in this. But the sketches/jsmodel.html didn't go quite far enough for me. My playing around lead me to this model

and I thought it might be helpful for others.

You can merge this Pull Request by running

git pull https://github.com/gepr/agentscript master

Or view, comment on, or merge it at:

https://github.com/backspaces/agentscript/pull/61 Commit Summary

  • o Added a heatbugs-like JavaScript model

File Changes

  • A models/pherbugs.html https://github.com/backspaces/agentscript/pull/61/files#diff-0 (117)

Patch Links:

  • https://github.com/backspaces/agentscript/pull/61.patch
  • https://github.com/backspaces/agentscript/pull/61.diff

— Reply to this email directly or view it on GitHub https://github.com/backspaces/agentscript/pull/61.

backspaces avatar Oct 09 '14 16:10 backspaces

Cool, nice to see you in here, Glen!

-S

--- -. . ..-. .. ... .... - .-- --- ..-. .. ... .... [email protected] 1600 Lena St #D1, Santa Fe, NM 87505 office: (505) 995-0206 mobile: (505) 577-5828 tw: @redfishgroup skype: redfishgroup redfish.com | simtable.com

On Thu, Oct 9, 2014 at 4:58 AM, gepr [email protected] wrote:

I don't know if you're interested in this. But the sketches/jsmodel.html didn't go quite far enough for me. My playing around lead me to this model

and I thought it might be helpful for others.

You can merge this Pull Request by running

git pull https://github.com/gepr/agentscript master

Or view, comment on, or merge it at:

https://github.com/backspaces/agentscript/pull/61 Commit Summary

  • o Added a heatbugs-like JavaScript model

File Changes

  • A models/pherbugs.html https://github.com/backspaces/agentscript/pull/61/files#diff-0 (117)

Patch Links:

  • https://github.com/backspaces/agentscript/pull/61.patch
  • https://github.com/backspaces/agentscript/pull/61.diff

Reply to this email directly or view it on GitHub https://github.com/backspaces/agentscript/pull/61.

stephenguerin avatar Oct 09 '14 16:10 stephenguerin

OK. I changed it in my fork. Should I send another pull request?

gepr avatar Oct 09 '14 16:10 gepr

No particular insights, since I'm not really competent with JavaScript. I had to muddle my way through. I can say that I much prefer it over CoffeeScript, though.

gepr avatar Oct 09 '14 16:10 gepr

On Thu, Oct 9, 2014 at 10:50 AM, gepr [email protected] wrote:

No particular insights, since I'm not really competent with JavaScript. I had to muddle my way through. I can say that I much prefer it over CoffeeScript, though.

​The last statement is key: CS is like liver, you love it or hate it!

We have a future plan to convert from CS to ES6/Traceur. And the browsers are starting to get a lot of es6 features so our traceur use will be less and less as time goes by.

Nice to see you here.

-- Owen​

backspaces avatar Oct 09 '14 18:10 backspaces

Hey @gepr ! Sorry to take so long to look at this. Thanks for the PR--we're definitely in need of a better javascript example, and this one's great!

I'll make some inline comments. See what you think and then we can merge.

bennlich avatar Oct 30 '14 21:10 bennlich

I've added explanatory comments to step(), declared myModel as var, and explained [un]happiness in a comment. Let me know if there's any other changes you'd like to see.

I spent a bit of time awhile back trying to split out the JavaScript code so that it loads from a file and includes the AS pre-reqs, via http://requirejs.org/. But I failed. So, I'll be interested to see how you separate the html and js.

gepr avatar Oct 31 '14 19:10 gepr