EssexUniversityMCTS / gvgai

This is the framework for the General Video Game Competition - http://www.gvgai.net/
Other
140 stars 69 forks source link

Fixed bug in converting json to SSO #80

Closed EndingCredits closed 7 years ago

EndingCredits commented 7 years ago

The elements in the SSO object were being replaced with references to itself. This fix causes these elements to instead be replaced with raw dictionaries (which I assume was the intention).

ljialin commented 7 years ago

Hi William, Thanks for your comment. But I did not see the problem with this line. Did I miss something ? Could you please clarify? Thank you! I apologise for the late reply. I was improving the framework according to some feedbacks and fixing some bugs. You may want to do a git pull. A more detailed and updated instruction page can be found here: https://github.com/EssexUniversityMCTS/gvgai/wiki/How-to-test Thank you! Best regards, Jialin

EndingCredits commented 7 years ago

Hi Jialin, Sorry, should have included more info. This is an issue in the python client in the way the information is parsed from a json dict to a SSO where some elements of the dict are replaced by a reference to the same SSO object, rather than being populated correctly. Best way to see this is to modify the sample agent in the Agent class and add:

    def init(self, sso, elapsedTimer):
        print vars(sso)

You'll see a very long list of items, but you should see something like <SerializableStateObservation.SerializableStateObservation instance at 0x14dbcf8> appear in a number of fields.

I don't know exactly why this happens (I don't know the ins and outs of how json.loads works) but my change seems to fix the issue.

N.B: I tested on python 2.7, but I wasn't able to run the script in python 3 (got a string encoding error).

Best wishes, Will