IPVGO: Handle RNG seeding and visual board updating bugs (#1258)

This commit is contained in:
Michael Ficocelli 2024-05-10 04:58:09 -04:00 committed by GitHub
parent b53c35126e
commit 591ad45154
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 1 deletions

@ -8,7 +8,7 @@ import { floor } from "./boardState";
type rand = (n1: number, n2: number) => number; type rand = (n1: number, n2: number) => number;
export function addObstacles(boardState: BoardState) { export function addObstacles(boardState: BoardState) {
const rng = new WHRNG(Player.totalPlaytime); const rng = new WHRNG(Player.totalPlaytime ?? new Date().getTime());
const random = (n1: number, n2: number) => n1 + floor((n2 - n1 + 1) * rng.random()); const random = (n1: number, n2: number) => n1 + floor((n2 - n1 + 1) * rng.random());
const shouldRemoveCorner = !random(0, 4); const shouldRemoveCorner = !random(0, 4);

@ -166,6 +166,7 @@ export function GoGameboardWrapper({ showInstructions }: GoGameboardWrapperProps
function setTraditional(newValue: boolean) { function setTraditional(newValue: boolean) {
Settings.GoTraditionalStyle = newValue; Settings.GoTraditionalStyle = newValue;
rerender();
} }
const endGameAvailable = boardState.previousPlayer === GoColor.white && boardState.passCount; const endGameAvailable = boardState.previousPlayer === GoColor.white && boardState.passCount;