Giter Club home page Giter Club logo

Comments (5)

dorian4840 avatar dorian4840 commented on August 10, 2024

There isn't a specific reason why we store the Node object instead of the coordinates.

We noticed that the agents in the graph need to store more than just their current location (energy and attached blocks, for example), so we will change self.current = {agent_id: self.nodes[(0, 0)]} to something like self.info {agent_id: {'node': self.nodes[(0, 0)], 'energy': 300}}. Then we could make separate keys for the node object and the location. It's just that by simple doing Node.location you can get the location of the node, so storing the location as well just seems like an unnecessary thing to keep track of.

We could only store the location and not the Node Object itself, but then we would have to change the entire code for something that doesn't add extra clarify or practical value

from mapc-uva.

DanielPerezJensen avatar DanielPerezJensen commented on August 10, 2024

That makes sense, but the reason I find it a bit unwieldy is this, I want to check if a given node is the node an agent is currently located in. Because of the dictionary structure I hvae to do it like this:

if node.location == self.beliefs.current[self._user_id].location

It would be nicer if we could have either:

  • A function that does it for us
if node.location == self.current_location()

or

  • Simply storing it as a named variable in the Graph object
if node.location == self.current_location

from mapc-uva.

dorian4840 avatar dorian4840 commented on August 10, 2024

You're right, it is a bit of a mouthful. I'll create the current_location() function (if we were to do a variable we would also need to keep updating it).

from mapc-uva.

dorian4840 avatar dorian4840 commented on August 10, 2024

I added the function current_info() to agent.py.

def current_info(self, info):
    if info == 'location':
        return self.beliefs.get_current(self._user_id).location
    elif info == 'node':
        return self.beliefs.get_current(self._user_id)

This way you can easily get the current location as well as the node, + you can easily also add other information in necessary

from mapc-uva.

DanielPerezJensen avatar DanielPerezJensen commented on August 10, 2024

I would split it up as two functions, current_location() and current_node(). I'll do it in a separate branch.

from mapc-uva.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.