[433e0c5] | 1 | export function getWinningBets(magicNumber) {
|
---|
| 2 | let winningBets = [];
|
---|
| 3 | winningBets.push(magicNumber);
|
---|
| 4 |
|
---|
| 5 | if (magicNumber != 0) {
|
---|
| 6 | if ((magicNumber <= 9 && magicNumber % 2 == 1) || (magicNumber > 10 && magicNumber <= 18 && magicNumber % 2 == 0) ||
|
---|
| 7 | (magicNumber > 19 && magicNumber <= 27 && magicNumber % 2 == 1) || (magicNumber > 27 && magicNumber % 2 == 0)) {
|
---|
| 8 |
|
---|
| 9 | winningBets.push('Red');
|
---|
| 10 | }
|
---|
| 11 | else {
|
---|
| 12 | winningBets.push('Black');
|
---|
| 13 | }
|
---|
| 14 |
|
---|
| 15 | if (magicNumber % 2 === 0) winningBets.push('Even');
|
---|
| 16 | else winningBets.push('Odd');
|
---|
| 17 |
|
---|
| 18 | if (magicNumber <= 12) winningBets.push('1-12');
|
---|
| 19 | else if (magicNumber <= 24) winningBets.push('13-24');
|
---|
| 20 | else winningBets.push('25-36');
|
---|
| 21 |
|
---|
| 22 | if (magicNumber <= 18) winningBets.push('1-18');
|
---|
| 23 | else winningBets.push('19-36');
|
---|
| 24 |
|
---|
| 25 | if (magicNumber % 3 === 0) winningBets.push('Remainder3');
|
---|
| 26 | else if (magicNumber % 3 === 2) winningBets.push('Remainder2');
|
---|
| 27 | else winningBets.push('Remainder1');
|
---|
| 28 | }
|
---|
| 29 |
|
---|
| 30 | return winningBets;
|
---|
| 31 | }
|
---|
| 32 |
|
---|
| 33 | export function calculateWinnings(player) {
|
---|
| 34 | if (player.outcome === 'lost') return 0;
|
---|
| 35 |
|
---|
| 36 | let bets = player.whichBets;
|
---|
| 37 | let bet = player.betAmount;
|
---|
| 38 |
|
---|
| 39 | if (bets[0] === 'Even' || bets[0] === 'Odd') return 2 * bet;
|
---|
| 40 | else if (bets[0] === 'Red' || bets[0] === 'Black') return 2 * bet;
|
---|
| 41 | else if (bets[0].includes('Remainder')) return 3 * bet;
|
---|
| 42 | else if (bets[0] === '1-12' || bets[0] === '13-24' || bets[0] === '25-36') return 3 * bet;
|
---|
| 43 | else if (bets[0] === '1-18' || bets[0] === '19-36') return 2 * bet;
|
---|
| 44 | else if (bets.length === 4) return 9 * bet;
|
---|
| 45 | else if (bets.length === 2) return 18 * bet;
|
---|
| 46 | else if (bets.length === 1) return 36 * bet;
|
---|
| 47 |
|
---|
| 48 | return 0;
|
---|
| 49 | } |
---|