google-deepmind / hanabi-learning-environment

hanabi_learning_environment is a research platform for Hanabi experiments.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error when trying to access certain card_knowledge functions

DanLoran opened this issue · comments

Hi!
I'm trying to read one attribute of the card knowledge but I get stuck when I call the line

observation.card_knowledge()[player][card_id].color_plausible(0):

where player and card_id are integers. I get the following error.

  File "/home/lorenzo/hanabi-learning-environment/pyhanabi.py", line 241, in color_plausible
    return lib.ColorIsPlausible(self._knowledge, color_index)
  File "/home/lorenzo/.local/lib/python2.7/site-packages/cffi/api.py", line 908, in __getattr__
    make_accessor(name)
  File "/home/lorenzo/.local/lib/python2.7/site-packages/cffi/api.py", line 903, in make_accessor
    raise AttributeError(name)
AttributeError: ColorIsPlausible

If I try to print just the variable I get

observation.card_knowledge()[player][card_id]
output: XX | RYGWB12345

This applies to the color_plausible and rank_plausible functions.

I am not very familiar with cffi but I was able to trace the problem back to cffi source code (api.py), where the aforementioned functions were not present in the accessors variable during update_accessor method nor the library.dict in the make_accessor method. I suspect that this issue is being caused by cffi not being pointed to the correct functions to bind, but I am too inexperienced with cffi to confirm this.

Please let me know if there is any additional information I can provide to assist in solving this issue.
Thank you,
Daniel

You're right - pyhanabi.h was not declaring the correct function in pyhanabi.cc. That has been fixed.
Thank you for the clearly written issue.