🐛 (engine) auction should follow clockwise order
This commit is contained in:
parent
fd49e66353
commit
0b7924653b
4 changed files with 31 additions and 17 deletions
|
|
@ -269,7 +269,7 @@ export function move(G: GameState, move: Move, playerNumber: number, fake?: bool
|
|||
pretty: `${playerNameHTML(player)} bids <span style="color: green">$${move.data}</span>`,
|
||||
});
|
||||
|
||||
nextPlayerAuction(G);
|
||||
nextPlayerClockwise(G);
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -333,7 +333,7 @@ export function move(G: GameState, move: Move, playerNumber: number, fake?: bool
|
|||
}
|
||||
}
|
||||
} else {
|
||||
nextPlayerAuction(G);
|
||||
nextPlayerClockwise(G);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -815,11 +815,21 @@ export function reconstructState(initialState: GameState, log: LogItem[]): GameS
|
|||
return G;
|
||||
}
|
||||
|
||||
export function nextPlayer(G: GameState) {
|
||||
const index = G.playerOrder.indexOf(G.currentPlayers[0]);
|
||||
G.currentPlayers = [G.playerOrder[(index + 1) % G.players.length]];
|
||||
export function nextPlayerClockwise(G: GameState) {
|
||||
const index = G.currentPlayers[0];
|
||||
G.currentPlayers = [(index + 1) % G.players.length];
|
||||
|
||||
if (G.players[G.currentPlayers[0]].isDropped && G.players.some((p) => !p.isDropped)) nextPlayer(G);
|
||||
if (G.players[G.currentPlayers[0]].isDropped && G.players.some((p) => !p.isDropped)) {
|
||||
G.players[G.currentPlayers[0]].skipAuction = true;
|
||||
nextPlayerClockwise(G);
|
||||
}
|
||||
|
||||
if (
|
||||
(G.players[G.currentPlayers[0]].skipAuction || G.players[G.currentPlayers[0]].passed) &&
|
||||
G.players.some((p) => !p.skipAuction && !p.passed)
|
||||
) {
|
||||
nextPlayerClockwise(G);
|
||||
}
|
||||
}
|
||||
|
||||
export function nextPlayerReverse(G: GameState) {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ module.exports = {
|
|||
'vue/no-unused-vars': 'error',
|
||||
'vue/html-indent': ['error', 4, { alignAttributesVertically: false }],
|
||||
'vue/max-attributes-per-line': 0,
|
||||
'vue/html-self-closing': 'off',
|
||||
'vue/attribute-hyphenation': ['error', 'never'],
|
||||
'vue/singleline-html-element-content-newline': 'off',
|
||||
'no-case-declarations': 'off',
|
||||
|
|
|
|||
|
|
@ -556,7 +556,10 @@
|
|||
<div>
|
||||
<strong>Phases:</strong>
|
||||
<ul>
|
||||
<li><strong>Determine Turn Order</strong> by cities built and highest power plant</li>
|
||||
<li>
|
||||
<strong>Determine Turn Order</strong> by number of cities built and highest power plant
|
||||
owned
|
||||
</li>
|
||||
<li>
|
||||
<strong>Buy Power Plants</strong> from the actual market (minimun bid is power plant number)
|
||||
</li>
|
||||
|
|
@ -618,7 +621,7 @@
|
|||
<div>
|
||||
Game ends after building phase where a player has <strong>{{ G.citiesToEndGame }}</strong> or more
|
||||
cities.<br />
|
||||
The winner is the player that can power more cities. Money and number of cities built are
|
||||
The winner is the player that can power the most cities. Money and number of cities built are
|
||||
tiebrakers.
|
||||
</div>
|
||||
<br />
|
||||
|
|
@ -627,13 +630,13 @@
|
|||
<table class="payment-table">
|
||||
<tr>
|
||||
<td><strong>Cities</strong></td>
|
||||
<template v-for="index in 21">
|
||||
<template v-for="index in G.citiesToEndGame">
|
||||
<td :key="'cities' + index">{{ index - 1 }}</td>
|
||||
</template>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Payment</strong></td>
|
||||
<template v-for="index in 21">
|
||||
<template v-for="index in G.citiesToEndGame">
|
||||
<td :key="'payment' + index">${{ G.paymentTable[index - 1] }}</td>
|
||||
</template>
|
||||
</tr>
|
||||
|
|
@ -1153,7 +1156,7 @@ export default class Game extends Vue {
|
|||
|
||||
return 'Choose a Power Plant to start an auction.';
|
||||
} else if (currentPlayer.availableMoves![MoveName.Bid]) {
|
||||
return "It's your turn to bid!";
|
||||
return 'It\'s your turn to bid!';
|
||||
} else if (currentPlayer.availableMoves![MoveName.BuyResource]) {
|
||||
return 'Buy resources on the market, or pass.';
|
||||
} else if (currentPlayer.availableMoves![MoveName.Build]) {
|
||||
|
|
@ -1170,7 +1173,7 @@ export default class Game extends Vue {
|
|||
return 'Choose which resources to discard.';
|
||||
}
|
||||
|
||||
return "It's your turn!";
|
||||
return 'It\'s your turn!';
|
||||
} else {
|
||||
let log = (this.G.log[this.G.log.length - 1] as LogMove).pretty;
|
||||
if (log) {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ function launchSelfContained(selector = '#app') {
|
|||
|
||||
const emitter = launch(selector);
|
||||
|
||||
let gameState = setup(2, {});
|
||||
let gameState = setup(6, {});
|
||||
|
||||
for (let i = 0; i < gameState.players.length; i++) {
|
||||
gameState.players[i].name = `Player ${i + 1}`;
|
||||
|
|
@ -27,7 +27,7 @@ function launchSelfContained(selector = '#app') {
|
|||
|
||||
emitter.emit('state', cloneDeep(strip ? stripSecret(gameState, playerIndex) : gameState));
|
||||
|
||||
let delay = 200;
|
||||
let delay = 1000;
|
||||
while (gameState.players.some((pl) => pl.isAI && pl.availableMoves)) {
|
||||
gameState = moveAI(
|
||||
gameState,
|
||||
|
|
@ -36,7 +36,7 @@ function launchSelfContained(selector = '#app') {
|
|||
let newState = cloneDeep(strip ? stripSecret(gameState, playerIndex) : gameState);
|
||||
console.log('new game state', newState);
|
||||
setTimeout(() => emitter.emit('state', newState), delay);
|
||||
delay += 200;
|
||||
delay += 1000;
|
||||
}
|
||||
|
||||
console.log('available moves', gameState.players[playerIndex].availableMoves);
|
||||
|
|
@ -49,7 +49,7 @@ function launchSelfContained(selector = '#app') {
|
|||
emitter.emit('player', { index: playerIndex });
|
||||
emitter.emit('state', cloneDeep(strip ? stripSecret(gameState, playerIndex) : gameState));
|
||||
|
||||
let delay = 200;
|
||||
let delay = 1000;
|
||||
while (gameState.players.some((pl) => pl.isAI && pl.availableMoves)) {
|
||||
gameState = moveAI(
|
||||
gameState,
|
||||
|
|
@ -57,7 +57,7 @@ function launchSelfContained(selector = '#app') {
|
|||
);
|
||||
let newState = cloneDeep(strip ? stripSecret(gameState, playerIndex) : gameState);
|
||||
setTimeout(() => emitter.emit('state', newState), delay);
|
||||
delay += 200;
|
||||
delay += 1000;
|
||||
}
|
||||
|
||||
console.log('available moves', gameState.players[playerIndex].availableMoves);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue