mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-26 17:43:48 +01:00
Merge pull request #2745 from jamie-mac/fix/roulette-result
Fix incorrect result being detected on the roulette table
This commit is contained in:
commit
9fa706073f
@ -40,13 +40,13 @@ const strategies: {
|
|||||||
} = {
|
} = {
|
||||||
Red: {
|
Red: {
|
||||||
match: (n: number): boolean => {
|
match: (n: number): boolean => {
|
||||||
if (n === 0) return false;
|
|
||||||
return redNumbers.includes(n);
|
return redNumbers.includes(n);
|
||||||
},
|
},
|
||||||
payout: 1,
|
payout: 1,
|
||||||
},
|
},
|
||||||
Black: {
|
Black: {
|
||||||
match: (n: number): boolean => {
|
match: (n: number): boolean => {
|
||||||
|
if (n === 0) return false;
|
||||||
return !redNumbers.includes(n);
|
return !redNumbers.includes(n);
|
||||||
},
|
},
|
||||||
payout: 1,
|
payout: 1,
|
||||||
@ -118,12 +118,6 @@ export function Roulette(props: IProps): React.ReactElement {
|
|||||||
const [status, setStatus] = useState<string | JSX.Element>("waiting");
|
const [status, setStatus] = useState<string | JSX.Element>("waiting");
|
||||||
const [n, setN] = useState(0);
|
const [n, setN] = useState(0);
|
||||||
const [lock, setLock] = useState(true);
|
const [lock, setLock] = useState(true);
|
||||||
const [strategy, setStrategy] = useState<Strategy>({
|
|
||||||
payout: 0,
|
|
||||||
match: (): boolean => {
|
|
||||||
return false;
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const i = window.setInterval(step, 50);
|
const i = window.setInterval(step, 50);
|
||||||
@ -156,13 +150,12 @@ export function Roulette(props: IProps): React.ReactElement {
|
|||||||
return `${n}${color}`;
|
return `${n}${color}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function play(s: Strategy): void {
|
function play(strategy: Strategy): void {
|
||||||
if (reachedLimit(props.p)) return;
|
if (reachedLimit(props.p)) return;
|
||||||
|
|
||||||
setCanPlay(false);
|
setCanPlay(false);
|
||||||
setLock(false);
|
setLock(false);
|
||||||
setStatus("playing");
|
setStatus("playing");
|
||||||
setStrategy(s);
|
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
let n = Math.floor(rng.random() * 37);
|
let n = Math.floor(rng.random() * 37);
|
||||||
|
Loading…
Reference in New Issue
Block a user