mercredi 30 mai 2018

Is it possible to create a switch group in Netlogo?

Sorry if this question is weird, I'm still switching over my programming brain from OOP.

Problem

I have a collection of switches. And I want to create the same amount of patch breeds as switches that are currently on.

How I would solve it

For example in python I would use the following code to get the number of switches with value 1:

sum(switch_hashmap.values())

Question

So my question stems from my neophyte approach to solving this problem. By thinking of switches as an object that has elementary functions built into it. I'm avoiding writing a dozen if blocks as that smells like bad design.

Is this possible in netlogo? What is the best practice here?

Aucun commentaire:

Enregistrer un commentaire