matrx-software / matrx

Human-Agent Teaming Rapid Experimentation Software
https://www.matrx-software.com
MIT License
10 stars 3 forks source link

State fails to locate objects given a location #288

Closed jwaa closed 3 years ago

jwaa commented 3 years ago

Describe the bug State[{"location":(1,1)}] or its more readable equivalent State.get_with_property({"location":(1,1)}, combined=True) fails to return the correct objects (in this example all objects at location 1,1).

To Reproduce

objects_at_loc = State[{"location":(1,1)}]

Expected behavior To only return the objects actually at that location, not a list of objects that have seemingly nothing in common.

Screenshots N/A

Stacktrace N/A

Additional context Came across this bug when we tested #202

jwaa commented 3 years ago

This behaviour is caused by how State functions when queried like this:

objs = State[{"foo": ["bar1", "bar2"] }]

In this case the State will look for all objects that have the property "foo" with as value "bar1" or "bar2". In the case of the location it will thus search for all objects that have 1 or 1 as its value. Returning all objects that have 1 as either their x- or y-coordinate.

A straightforward fix is to tackle the location property as an outlier and treat its value (in the example (1,1)) as is, instead of as a list of potential values allowed.