🐛 (engine) Fix final rankings

This commit is contained in:
coyotte508 2021-08-18 10:14:26 +02:00
commit 074fe8c74e
2 changed files with 3 additions and 2 deletions

View file

@ -873,7 +873,7 @@ function calculateEndScore(G: GameState) {
}
export function scores(G: GameState): number[] {
return G.players.map((_) => 0);
return ended(G) ? G.players.map((p) => p.money) : G.players.map((_) => 0);
}
export function reconstructState(initialState: GameState, log: LogItem[]): GameState {

View file

@ -32,7 +32,8 @@ export function rankings(G: GameState) {
return p1.money - p2.money;
}
})
.map((pl) => pl.id);
.map((pl) => pl.id)
.reverse();
return G.players.map((pl) => sortedPlayers.indexOf(pl.id) + 1);
}