Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getStone() function always returning zero #31

Open
chinuuuu opened this issue Mar 11, 2023 · 1 comment
Open

getStone() function always returning zero #31

chinuuuu opened this issue Mar 11, 2023 · 1 comment

Comments

@chinuuuu
Copy link

when i tried to extract the board position in a 2d array format using getstone function, every time zero is returned for each and every position irrespective of the stones placed on the board

@yewang
Copy link
Owner

yewang commented Mar 11, 2023

Could you provide an example of how you are encountering this issue?

The getStone function is integral to the basic operation of BesoGo. Playing moves, applying the capture rule, and editing the board requires the getStone function to work properly. In order for the board to be properly rendered, the boardDisplay queries the board state via the getStone function.

This is speculation, but are you only calling the getStone function on the reference to the root node of the game tree? That should usually result in returning 0 for every position (unless you have edited the board position in the root node via set stones).

To get the board state for other nodes in the game tree, you need to call the getStone function on those other descendant nodes. Each node in the game tree has a list of its children (if any). Note that as you traverse the game tree via the editor, a reference to the current position in the tree is held in the variable called current. Hope this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants