Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/games/frogger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1072,7 +1072,10 @@ export class FroggerGame extends GameBase {
} else if (currmove === "") {
//Deal with the refill button.
if (this.variants.includes("refills") && piece === "refill") {
newmove = `${move.slice(0,-1)}!/`;
if (move.indexOf("!") < 0)
newmove = `${move.slice(0,-1)}!/`;
else
newmove = move;
} else {
// starting another move (forward).
newmove = `${move}${piece!.substring(1)}:`;
Expand Down
17 changes: 17 additions & 0 deletions test/games/frogger.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,22 @@ describe("Frogger", () => {

});

it ("Implements the refills market variant", () => {
const g = new FroggerGame(`{"game":"frogger","numplayers":2,"variants":["courts","#market","refills"],"gameover":false,"winner":[],"stack":[{"_version":"20251220","_results":[],"_timestamp":"2025-12-29T03:38:17.329Z","currplayer":1,"board":{"dataType":"Map","value":[["b4","7VY"],["c4","PVLY"],["d4","PMSL"],["e4","2MK"],["f4","3LY"],["g4","PMYK"],["h4","5ML"],["i4","8YK"],["j4","NY"],["k4","PSVK"],["l4","1L"],["m4","6MV"],["a3","X1-6"],["a2","X2-6"]]},"closedhands":[["TSLK","NM","9LK","TMLY"],["9MS","7SK","1K","2VL"]],"hands":[[],[]],"market":["NS","3SK","TMVK","5YK","TSVY","NV"],"discards":[],"nummoves":3}]}`);
//Setup.
g.move("NM:a3-d3/9LK:a3-c2/TSLK:a3-d2/");
g.move("9MS:a2-k3/7SK:a2-n2/1K:k3-n2/");
g.move("d3-c3,5YK/c2-b2,TMVK/d2-c2,TSVY/");
g.move("2VL:a2-d1/d1-c1,3SK/c1-b3,NS/");
//Player one attempts to refill the market.
expect(g.validateMove("5YK:b2-e2/e2-d2,NV!/")).to.have.deep.property("valid", true);

//Eat double refill clicks.
expect(g.handleClick("5YK:b2-e2/e2-d2,NV/", -1, -1, "refill")).to.have.deep.property("move", "5YK:b2-e2/e2-d2,NV!/");
expect(g.handleClick("5YK:b2-e2/e2-d2,NV!/", -1, -1, "refill")).to.have.deep.property("move", "5YK:b2-e2/e2-d2,NV!/");

});

it ("Implements the original market rules", () => {
const g = new FroggerGame(`{"game":"frogger","numplayers":2,"variants":["courtpawns"],"gameover":false,"winner":[],"stack":[{"_version":"20251229","_results":[],"_timestamp":"2025-12-31T23:44:13.590Z","currplayer":1,"board":{"dataType":"Map","value":[["b4","3SK"],["c4","7VY"],["d4","TSVY"],["e4","5YK"],["f4","2SY"],["g4","8MS"],["h4","3LY"],["i4","TSLK"],["j4","1Y"],["k4","TMLY"],["l4","1S"],["m4","TMVK"],["a3","X1-6"],["a2","X2-6"]]},"closedhands":[["1L","1K","6LK","6SY"],["NY","1V","NS","NM"]],"hands":[[],[]],"market":["9LK","NK","9VY","8YK","2MK","6MV"],"discards":[],"nummoves":3}]}`);

Expand All @@ -363,6 +379,7 @@ describe("Frogger", () => {
//Second move is back to the Excuse.
expect(g.validateMove("NY:a2-c2/c2-b2,NK/b2-a2,9LK/")).to.have.deep.property("valid", false);
expect(g.validateMove("NY:a2-c2/c2-b2,9VY/b2-a2,NK/")).to.have.deep.property("valid", true);

});

it ("Implements the free swim variant", () => {
Expand Down