Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | 187x 187x 187x 187x 187x 187x 253x 88x 88x 253x 25x 25x 253x 253x 147x 147x 253x 147x 106x | export class Frame {
numero: number
arremessos: number
pinos_em_pe: number
strike: boolean
spare: boolean
bonus: number
constructor(numero: number) {
this.numero = numero
this.arremessos = 0
this.pinos_em_pe = 10
this.strike = false
this.spare = false
this.bonus = 0
}
adicionarBonus(pinos: number): void {
if (this.arremessos === 0 && pinos === 10) {
this.strike = true
this.bonus = 2
}
if (this.arremessos === 1 && pinos === this.pinos_em_pe) {
this.spare = true
this.bonus = 1
}
}
gravarArremesso(pinos: number): void {
this.arremessos += 1
this.pinos_em_pe -= pinos
}
gerarProximoFrame(): Frame {
const proximo_frame: Frame = new Frame(this.numero + 1)
return proximo_frame
}
permitirEncerrarFrame(): boolean {
if (this.numero != 9 && (this.pinos_em_pe == 0 || this.arremessos === 2))
return true
return false
}
}
|