added who won text
This commit is contained in:
parent
d67904fe34
commit
0254cfdf4a
@ -74,7 +74,7 @@ export class Game {
|
|||||||
//check if it was 0 before
|
//check if it was 0 before
|
||||||
if (stopHole.ballCount == 1) {
|
if (stopHole.ballCount == 1) {
|
||||||
const ownStore = getOwnStore(circle)
|
const ownStore = getOwnStore(circle)
|
||||||
const opponentHole = getOpponentHoleByIndex(stopIndex%circle.length, circle)
|
const opponentHole = getOpponentHoleByIndex(stopIndex%16, circle)
|
||||||
|
|
||||||
if (opponentHole.ballCount > 0) {
|
if (opponentHole.ballCount > 0) {
|
||||||
ownStore.ballCount++
|
ownStore.ballCount++
|
||||||
@ -144,9 +144,9 @@ export class Game {
|
|||||||
const player2BallCount = this.board.player2Store.ballCount
|
const player2BallCount = this.board.player2Store.ballCount
|
||||||
|
|
||||||
if(player1BallCount < player2BallCount){
|
if(player1BallCount < player2BallCount){
|
||||||
return this.getPlayerKeyByName("player1")
|
|
||||||
}else if(player1BallCount > player2BallCount) {
|
|
||||||
return this.getPlayerKeyByName("player2")
|
return this.getPlayerKeyByName("player2")
|
||||||
|
}else if(player1BallCount > player2BallCount) {
|
||||||
|
return this.getPlayerKeyByName("player1")
|
||||||
}else{
|
}else{
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
@ -166,6 +166,10 @@ export function createGame(player1: string, player2: string) {
|
|||||||
// [new Hole(4), new Hole(4), new Hole(4), new Hole(4), new Hole(4), new Hole(1)],
|
// [new Hole(4), new Hole(4), new Hole(4), new Hole(4), new Hole(4), new Hole(1)],
|
||||||
// [new Hole(1), new Hole(0), new Hole(0), new Hole(0), new Hole(1), new Hole(0)],
|
// [new Hole(1), new Hole(0), new Hole(0), new Hole(0), new Hole(1), new Hole(0)],
|
||||||
// new Store(0), new Store(0))
|
// new Store(0), new Store(0))
|
||||||
|
// const board = new Board(
|
||||||
|
// [new Hole(1), new Hole(1), new Hole(1), new Hole(1), new Hole(1), new Hole(1)],
|
||||||
|
// [new Hole(1), new Hole(1), new Hole(1), new Hole(1), new Hole(1), new Hole(1)],
|
||||||
|
// new Store(0), new Store(0))
|
||||||
return new Game(player1, player2, board, "player1", "playing")
|
return new Game(player1, player2, board, "player1", "playing")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user