gamble
Privateunrated
Content
43 lines{=(COMMENT):prob prize pay
return true if:
prob * prize > pay}
{=(jargs):{join(~):{args}}}
{=(prob):{replace(%,):{list(0):{jargs}}}}
{=(prob):{if({in(.):{prob}}==false):{m:{prob}/100}|{prob}}}
{=(prize):{list(1):{jargs}}}
{=(pay):{list(2):{jargs}}}
{=(gamble):{m:{prob}*{prize}}}
{=(isProfitable):{if({gamble}>{pay}):true|false}}
{=(is3args):{contains(3):{index($&!):{args} $&!}}}
{=(netOucome):{replace(Z,):{replace(.0Z,):{m:{gamble}-{pay}}Z}}}
{=(success):
`prob:` {prob}
`prize:` {prize}
`pay:` {pay}
`Is it a profitable gamble?` {isProfitable}
`Net outcome:` {netOucome}
}
{=(error):A profitable gamble is a game that yields a positive net profit, where net profit is calculated in the following manner:
`net_outcome = probability_of_winning * prize - cost_of_playing`
[Inspired by Edabit's JavaScript Challenge](https://edabit.com/challenge/ghbHrRnRiDz9fvQNF "Profitable Gamble in JavaScript")
**Usage**```yaml
!gamble [prob] [prize] [pay]
```**Example**```yaml
!gamble 0.5 15 2
```
> 💡 Ensure that each argument is a positive integer.}
{=(output):{{if({is3args}==true):success|error}}}Embed
1 line{"color": 3092790, "description": "{output}"}Raw JSON
{
"id": 1473414,
"created_at": "2022-07-09T13:53:10.000Z",
"tag_name": "gamble",
"nsfw": false,
"owner_id": "149926720114262016",
"uses": 17,
"description": null,
"restricted": false,
"shared": false,
"deleted": false,
"safe": "unrated",
"hidden": false,
"guild_id": "314660900302749696",
"sharer": "149926720114262016",
"content": "{=(COMMENT):prob prize pay\n\nreturn true if:\nprob * prize > pay}\n\n{=(jargs):{join(~):{args}}}\n\n{=(prob):{replace(%,):{list(0):{jargs}}}}\n{=(prob):{if({in(.):{prob}}==false):{m:{prob}/100}|{prob}}}\n\n{=(prize):{list(1):{jargs}}}\n{=(pay):{list(2):{jargs}}}\n\n{=(gamble):{m:{prob}*{prize}}}\n\n{=(isProfitable):{if({gamble}>{pay}):true|false}}\n{=(is3args):{contains(3):{index($&!):{args} $&!}}}\n\n{=(netOucome):{replace(Z,):{replace(.0Z,):{m:{gamble}-{pay}}Z}}}\n\n{=(success):\n`prob:` {prob}\n`prize:` {prize}\n`pay:` {pay}\n\n`Is it a profitable gamble?` {isProfitable}\n\n`Net outcome:` {netOucome}\n}\n{=(error):A profitable gamble is a game that yields a positive net profit, where net profit is calculated in the following manner:\n`net_outcome = probability_of_winning * prize - cost_of_playing`\n\n[Inspired by Edabit's JavaScript Challenge](https://edabit.com/challenge/ghbHrRnRiDz9fvQNF \"Profitable Gamble in JavaScript\")\n\n**Usage**```yaml\n!gamble [prob] [prize] [pay]\n```**Example**```yaml\n!gamble 0.5 15 2\n```\n\n> 💡 Ensure that each argument is a positive integer.}\n\n{=(output):{{if({is3args}==true):success|error}}}",
"embed": "{\"color\": 3092790, \"description\": \"{output}\"}",
"last_fetched": "2026-10-20T18:53:41.488Z"
}