Comments (8)
It is dedicated to build groups.
this command works for me but I made a fix perhaps it will fix your issue.
5d10g10
The group operator bring together die values to reach the group value (10 in previous example).
And the final result is the group count. In some games it is your success count.
result: 3 9 6 10 2
This sum of the result is 30. So you may think there is 3 group but in fact you can only build 2.
Number can only be part of one group.
10 => 1 group
+
9+6 => 1 group ( lost 5)
or
9+2 => 1 group ( lost 1)
or
6+3+2 => 1 group (lost 1)
or
9+3 => 1 group ( lost 2)
from diceparser.
Isn't that just integer division?
10g3 => 3 group (lost 1)
from diceparser.
No it is more complex than that.
For example:
3d10g10 => 9, 9, 2
In this result, the integer division (9+9+2)/10 is 2
But in that case, g operator must return 1.
Because:
9+9 => 1 group (lost 8)
or
9+2 => 1 group (lost 1)
or
2+9 => 1 group (lost 1)
or
9+9 => 1 group (lost 8)
When you use a number, you lost it.
So if I use one 9 and the 2. I overcome 10. So I get one success. But one 9 remains and I can't reach 10 with 9.
Same if I use both 9, 18 > 10, So I get one success. But the 2 remains and I can't reach 10 with 2.
from diceparser.
Ok, thanks for the precision. I think you should add this example to the documentation.
from diceparser.
Btw, I'm happily surprise that he is able to correctly solve the backpack problem for case like 4d2g3
with the possible corner cases {2,2,1,1}
and {1,1,2,2}
who both need re-ordering. I just tested it, it effectively answers 2 in both cases.
from diceparser.
I'm not quiet sure my algorithm works every time and I can't prove it is right.
but as far I had tested, it never gives me a wrong result.
It was really funny to implement, but it is a bit dirty. Perhaps there are ways to make it cleaner and more optimized
from diceparser.
I found a corner case (see commit 1b00f06 in the PR #15). I'm sad because this mean that I can't just copie your code in my re-write draft.
from diceparser.
I set many unit test on rolisteam code and I fix an issue about g operator. It was en endless loop in some case.
from diceparser.
Related Issues (20)
- Macros activated from comment (#) and sentence display ("") HOT 1
- Exploding Doubles HOT 1
- No valid value at index HOT 5
- Question re: Syntax for an IF statement based on an Entered Number and a Dice Roll. HOT 2
- Bot stopped working with Discord's latest version HOT 6
- Prefix not working HOT 3
- All dice prefix commands not working HOT 3
- Diceparser not working with webhook
- DiceParser not working September 2022 HOT 1
- /r works but ! does not HOT 5
- Help Noob please! Bot Setup steps for RPG HOT 2
- Weird handling of numbers in lists
- Bot frequently does not respond
- Bot Not Responding In Any Server
- bot does not allow users below the rank of admin to roll HOT 3
- Broken example in HelpMe.md HOT 1
- List weight doesn't seem to work
- Dice Parse offline? HOT 2
- Ambiguous licensing HOT 1
- Discord bot privacy information
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from diceparser.