iamlucaswolf / gym-chess

OpenAI Gym environments for Chess
GNU General Public License v3.0
22 stars 20 forks source link

Returning AlphaZero Board #2

Open spencerstingley opened 3 years ago

spencerstingley commented 3 years ago

There doesn't appear to be any way to return the board for the AlphaZero implementation as an array unless you call the step function. The observation function requires a board call, which I cannot extract from the Chess environment (as far as I can tell). Am I missing something or is this genuinely impossible?

spencerstingley commented 3 years ago

I was able to solve the problem using env.observation(env.env.env._board). This is technically a fix and I will mark the question as closed. I hope there is a better way to do this and I'm missing it but if not, it would be a good place for improvement and I will fork the repo to add this function under something like 'alphazero_board' if it feels necessary

iamlucaswolf commented 3 years ago

Hi @spencerstingley

I agree, this is a hassle and IMHO a general weakness in the design of OpenAI Gym. I believe it would be much nicer (and lead to more natural code) if gym Envs were designed as "mutable containers of env state", rather than "producers of transitions".

Adding a state property or something along that line should be trivial; I hope to get to it next week if I find the time :)