Currently the highRoller() function is returning 2 numbers as playerFirstTotal and playerSecondTotal.
We should create an intermediate function that returns 2 number[2] arrays
This creates weird UI where all rolls seem to resolve to double dice rolls:
getDieNumbers(totalSum: number): [number, number] {
// Choose result for each die.
if (totalSum === 12) {
return [6, 6];
}
if (totalSum > 2 && totalSum < 12) {
return [Math.floor(totalSum / 2), Math.ceil(totalSum / 2)];
}
if (totalSum > 2 && totalSum % 2 === 0) {
return [Math.floor(totalSum / 2) - 1, Math.ceil(totalSum / 2) + 1];
}
return [totalSum / 2, totalSum / 2];
}
So a roll of 6 on the contract will always show [3,3] even if it was [6,0]
Currently the
highRoller()function is returning 2 numbers asplayerFirstTotalandplayerSecondTotal.We should create an intermediate function that returns 2 number[2] arrays
This creates weird UI where all rolls seem to resolve to double dice rolls:
So a roll of 6 on the contract will always show [3,3] even if it was [6,0]