Skip to content

games: Make Splendor end after last player has completed their turn - #118

Open
TannPat wants to merge 1 commit into
PartMan7:mainfrom
TannPat:splendor-end-bug
Open

games: Make Splendor end after last player has completed their turn#118
TannPat wants to merge 1 commit into
PartMan7:mainfrom
TannPat:splendor-end-bug

Conversation

@TannPat

@TannPat TannPat commented Aug 22, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

@TannPat TannPat linked an issue Aug 22, 2026 that may be closed by this pull request
@PartMan7 PartMan7 changed the title chore: Make games end after lastt player has completed their turn games: Make Splendor end after last player has completed their turn Aug 24, 2026
@PartMan7 PartMan7 added the bug Something isn't working label Aug 24, 2026
@PartMan7
PartMan7 self-requested a review August 24, 2026 07:13

@PartMan7 PartMan7 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent catch; thanks!

As a minor nit, try to group similar code into paragraphs instead of spacing out each line - you should be able to summarize each paragraph as one sentence (eg: check points/game end if the turn has ended)

}

gameCanEnd(): boolean {
gameCanEnd(turn: Turn | null = this.turn): boolean {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nit; any reason to send this from props? I think it's equivalent in this case.

Also, try to avoid shadowing

Comment on lines +384 to +388
const currentPlayer = this.turn;

const turnEnded: boolean = this.handlePostTurn(action, playerData, user, player, logEntry);

if (turnEnded && this.gameCanEnd(currentPlayer)) return this.end();

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const currentPlayer = this.turn;
const turnEnded: boolean = this.handlePostTurn(action, playerData, user, player, logEntry);
if (turnEnded && this.gameCanEnd(currentPlayer)) return this.end();
const turnEnded = this.handlePostTurn(action, playerData, user, player, logEntry);
if (turnEnded && this.gameCanEnd()) return this.end();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Splendor: Game end bugs

2 participants