Skip to content

Comments

New game: Nick Bentley's Product#317

Merged
Perlkonig merged 3 commits intoAbstractPlay:developfrom
jpneto:develop
Feb 20, 2026
Merged

New game: Nick Bentley's Product#317
Perlkonig merged 3 commits intoAbstractPlay:developfrom
jpneto:develop

Conversation

@jpneto
Copy link
Contributor

@jpneto jpneto commented Feb 19, 2026

No description provided.

Copy link
Member

@Perlkonig Perlkonig left a comment

Choose a reason for hiding this comment

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

See comments for a couple changes and questions. Thanks again for doing this work!

{ uid: "size-6", group: "board" },
{ uid: "size-7", group: "board" },
],
flags: ["scores", "no-moves"]
Copy link
Member

Choose a reason for hiding this comment

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

Please always add the experimental flag to new games.

currplayer: playerid;
board: Map<string, playerid>;
lastmove?: string;
scores: [number, number];
Copy link
Member

Choose a reason for hiding this comment

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

Since calculating the scores is trivial, there's no need to continually track the score move after move. It just inflates the game state. Just rely on getPlayerScore() (the backend uses this) and getPlayersScores() (what the front end uses, for reasons).

public stack!: Array<IMoveState>;
public results: Array<APMoveResult> = [];
public boardSize = 5;
public scores: [number, number] = [0, 0];
Copy link
Member

Choose a reason for hiding this comment

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

Can delete.

_timestamp: new Date(),
currplayer: 1,
board: new Map(),
scores: [0, 0],
Copy link
Member

Choose a reason for hiding this comment

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

Delete.

return otherCoordinates;
}

public handleClick(move: string, row: number, col: number, piece?: string): IClickResult {
Copy link
Member

Choose a reason for hiding this comment

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

I'm not quite clear on how players choose what colour stone to place. How do they place a piece belonging to the other player? You can see games like Manalath and Wunchunk for existing examples.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, but this way is much more user-friendly comparing to Wunchuck. All pieces of the current turn can cycle between friend -> enemy -> empty hex -> friend -> ...

Copy link
Member

Choose a reason for hiding this comment

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

I don't understand. I haven't tried to run it locally yet. You're saying they click multiple times on the same cell and the piece toggles between them? If so, we've done that in the past and got some push back (I don't remember the details now). I'm willing to try something, it just wasn't immediately clear to me how the code was working.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When a player clicks two hexes, it will be something like 1h4,1h5. If he clicks h2 again, the program will remake the move as 1h4,2h5, and another click on h2 will remake the move as 1h4 (a partial move, in this case). This happens in method processMoves.

It is much more pleasant that continuing going to the outside pieces in Wunchuck to play opponent pieces.

Copy link
Member

Choose a reason for hiding this comment

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

Very well. I will test this locally when we merge and see how it goes. What I like about the Wunchunk approach is that it is very explicit. It's hard to be confused. But I'll wait until I see it in action.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. It is almost like clicking on a current stone to make the hex empty again. Just an extra step in the cycle :-)

currentMove = move.slice(1);
const [, y] = this.graph.algebraic2coords(move.slice(1));
// `algebraic2coords` does not check if the cell is on the board fully.
if (y < 0) { throw new Error("Invalid cell."); }
Copy link
Member

Choose a reason for hiding this comment

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

I guess this works. The graph does give you a list of valid cells, so you can do a simple if (!this.graph.listCells().includes(cell)). Whatever works.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Your alternative is much clearer, but I wrote this

      if (! this.graph.listCells().includes(currentMove)) {
          throw new Error("Invalid cell.");
      }

and it gave me a strange compiler error: Argument of type 'string' is not assignable to parameter of type 'string & string[]. But, anyway, it's not that relevant.

currplayer: this.currplayer,
lastmove: this.lastmove,
board: new Map(this.board),
scores: [...this.scores]
Copy link
Member

Choose a reason for hiding this comment

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

Can delete.

}
return status;
}

Copy link
Member

Choose a reason for hiding this comment

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

When valid moves can have different forms/orders, it is usually necessary to add a sameMove() function. You can see Streetcar Suburb as an example. Because you already have a normaliseMove() function, it's as simple as the following:

    public sameMove(move1: string, move2: string): boolean {
        return this.normaliseMove(move1) === this.normaliseMove(move2);
    }

This is needed because of how exploration works.

@Perlkonig Perlkonig merged commit b6f712f into AbstractPlay:develop Feb 20, 2026
1 check passed
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

Successfully merging this pull request may close these issues.

2 participants