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

get() method of Chess class returns false instead null #427

Closed
GienKu opened this issue Jul 16, 2023 · 4 comments
Closed

get() method of Chess class returns false instead null #427

GienKu opened this issue Jul 16, 2023 · 4 comments

Comments

@GienKu
Copy link

GienKu commented Jul 16, 2023

Hello, I'm a beginner programmer, and I have encountered a problem as described in the title. I have also checked the implementation, which is as follows:
get(square: Square) { return this._board[Ox88[square]] || false }
Should it be like this?
console.log(game.get('a6')); // prints false

@jhlywa
Copy link
Owner

jhlywa commented Jul 16, 2023

Hi @GienKu. Welcome to programming and thanks for the report!

It looks like you found a typo in the code that has been there for over a year. Looking at it with fresh eyes (and with TypeScript) in mind, it may be more idiomatic for get to return a Piece | undefined. I'm going to leave this open for a few days while I decide on what to do.

Thanks!

@michelsafi
Copy link

hello. any update on this issue

@datacurse
Copy link

greetings! any chance of this being implemented?

Hi @GienKu. Welcome to programming and thanks for the report!

It looks like you found a typo in the code that has been there for over a year. Looking at it with fresh eyes (and with TypeScript) in mind, it may be more idiomatic for get to return a Piece | undefined. I'm going to leave this open for a few days while I decide on what to do.

Thanks!

@jhlywa
Copy link
Owner

jhlywa commented Oct 26, 2024

Fixed in commit 85c049e

@jhlywa jhlywa closed this as completed Oct 26, 2024
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

4 participants