-
Sep 8th, 2020, 12:18 PM
#1
Contest 14 - DnD Dice Roller
Programming Contest – DnD Dice Roller
For all those who haven't participated in the contest please read the FAQ
Overview
Given an input of dungeons and dragons dice commands, have the program execute the commands and show the user the results.
For example, if I input 1D20 1d% then the program should output:
Languages
C#, F#, JavaScript (vanilla ES5), LUA, Python, Visual Basic 6, and VB.Net
Deadline
October 2nd, 2020
Rules for Contest
The rules followed will be specific to the contest and not the game.
- You must submit the source code and include a fiddle(ideone, dotnetfiddle, codepen, etc.)
- You are responsible for determining the syntax of the dice command
- Allow for multiple dice commands
- Include a help menu to assist the user
- Acceptable dice types are:
- 4-sided
- 6-sided
- 8-sided
- 10-sided
- 12-sided
- 20-sided
- Percentage (percentages include increments of 10 from 0 - 90)
Marking
Each entry will be judged on the following things.
- Accuracy - Does the program follow all of the rules?
- Length - How concise is the submitted code?
- Execution - How quick did the code execute?
- Efficiency - How efficient is the algorithm(s) you chose?
Prizes
You will get to brag that you won a VBForums contest and I'll also include a special avatar!
Please submit all entry's to the forum below with the title in the following format "Contest 14 - DnD Dice Roller - [User Name]"
Contest Entries Forum
Last edited by dday9; Sep 14th, 2020 at 10:32 AM.
-
Sep 8th, 2020, 12:22 PM
#2
Re: Contest 14 - DnD Dice Roller
So the format is
<# of rolls>D<max value>?
So like
1D20 = 1 roll of 1-20
4D5 = 4 rolls of 1-5
2D% = 2 rolls of 1-100
?
-
Sep 8th, 2020, 01:16 PM
#3
Re: Contest 14 - DnD Dice Roller
I've updated my post to include the type types, but the format is correct (the output of 2D% would be different and 4D5 would be invalid because there isn't a 5 sided die).
-
Sep 13th, 2020, 08:42 AM
#4
Junior Member
Re: Contest 14 - DnD Dice Roller
I'm starting to write my entry now. My entry will be in C# Core but I might do one in Ada as well just for fun
Might be worth tweaking the rules a bit regarding percentage rolls. Standard percentage dice are numbered 00-90 and 0-9 (decades and units respectively), thus yielding values 0% through 99%.
Last edited by wossy; Sep 13th, 2020 at 11:35 AM.
On the bright side, I've still got pessimism and despair to fall back on.
-
Sep 14th, 2020, 08:10 AM
#5
Re: Contest 14 - DnD Dice Roller
Hmmm, I've always had a percentage die, which was 00-90 and then we rolled a D10 with it. So it would be 1D% + 1D10 to yield a percentage between 0-100.
-
Sep 14th, 2020, 09:35 AM
#6
Re: Contest 14 - DnD Dice Roller
IT depends on the die manufacturer.... I've got some that have the tens on them... others that have an odd colored 1d10 with just simple 0-9 on it... to be used as the tens... There is also a massive 1d100 out there.... so pick your poison and die carefully.
-tg
-
Sep 14th, 2020, 11:23 AM
#7
Junior Member
Re: Contest 14 - DnD Dice Roller
I believe the D100 has been outlawed by international convention as an offensive weapon.
I suppose it doesn't matter then as long as there are 100 distinct values available. In real life the DM would arbitrate any dispute and have final say no matter what.
Any dissenting players can be handily eaten by a beholder.
On the bright side, I've still got pessimism and despair to fall back on.
-
Sep 14th, 2020, 11:49 AM
#8
Re: Contest 14 - DnD Dice Roller
I shall be the DM of this competition and will thoroughly feed my beholders as I see fit.
-
Sep 15th, 2020, 04:35 AM
#9
Junior Member
Re: Contest 14 - DnD Dice Roller
Ouch, looks like I need to roll a constitution save.
On the bright side, I've still got pessimism and despair to fall back on.
-
Sep 15th, 2020, 10:28 AM
#10
Junior Member
Re: Contest 14 - DnD Dice Roller
Submitted my lame attempt at an entry
On the bright side, I've still got pessimism and despair to fall back on.
-
Sep 15th, 2020, 10:29 AM
#11
Re: Contest 14 - DnD Dice Roller
-
Sep 16th, 2020, 07:25 AM
#12
Re: Contest 14 - DnD Dice Roller
I'm reading https://en.wikipedia.org/wiki/Dice_notation
Are multipliers and expressions allowed? e.g. 3x(2d6+4) or d4 + 2d6 + 4 - 3d8 + 6d7/2
cheers,
</wqw>
-
Sep 16th, 2020, 08:12 AM
#13
Re: Contest 14 - DnD Dice Roller
Multiple dice can be rolled at once, the syntax would look something along the lines of: 1D8 1D% 6D4
I'd expect, at minimum, for it show the results of each individual die roll (in this case 8 results).
-
Sep 16th, 2020, 08:19 AM
#14
Junior Member
Re: Contest 14 - DnD Dice Roller
I suppose there's no harm in allowing additional features (as I have done in my entry) as long as they are not mandatory. It's nice to let people show off a bit, and might be useful in the event of a tie-break situation.
On the bright side, I've still got pessimism and despair to fall back on.
-
Sep 16th, 2020, 04:03 PM
#15
Re: Contest 14 - DnD Dice Roller
What do you mean by and how do we do that ?
The best friend of any programmer is a search engine
"Don't wish it was easier, wish you were better. Don't wish for less problems, wish for more skills. Don't wish for less challenges, wish for more wisdom" (J. Rohn)
“They did not know it was impossible so they did it” (Mark Twain)
-
Sep 16th, 2020, 04:24 PM
#16
Re: Contest 14 - DnD Dice Roller
In wossname's case, his program relied on command line arguments and so he wasn't able to submit a fiddle.
However, the service I prefer for .NET console fiddles is dotnetfiddle.net. Follow these steps:
- Go to the website
- Specify the language: C#, VB.NET, or F#
- Copy/paste your code in the text editor
- Click on the Run button
Once it runs, you can interact with the console via the split window at the bottom. In order to generate a link to your fiddle, click on the Share button.
Here is an example: https://dotnetfiddle.net/PVKGWK
-
Sep 16th, 2020, 04:44 PM
#17
Re: Contest 14 - DnD Dice Roller
Hum and how do I pass the form, textbox, labels, help menu and other things in the fiddle?
Last edited by Delaney; Sep 16th, 2020 at 04:50 PM.
The best friend of any programmer is a search engine
"Don't wish it was easier, wish you were better. Don't wish for less problems, wish for more skills. Don't wish for less challenges, wish for more wisdom" (J. Rohn)
“They did not know it was impossible so they did it” (Mark Twain)
-
Sep 16th, 2020, 04:49 PM
#18
Re: Contest 14 - DnD Dice Roller
You can't, it is specifically for console applications. If you wanted to implement GUI then you wouldn't be able to submit a fiddle (which is fine).
-
Sep 16th, 2020, 04:50 PM
#19
Re: Contest 14 - DnD Dice Roller
An other question : it is not in the rules but do we have to check for input error and/or incorrect dice (1d7 for example) ?
Last edited by Delaney; Sep 16th, 2020 at 04:54 PM.
The best friend of any programmer is a search engine
"Don't wish it was easier, wish you were better. Don't wish for less problems, wish for more skills. Don't wish for less challenges, wish for more wisdom" (J. Rohn)
“They did not know it was impossible so they did it” (Mark Twain)
-
Sep 16th, 2020, 06:31 PM
#20
Re: Contest 14 - DnD Dice Roller
Ok, I submited my contribution. Thanks for the fun !
regards
The best friend of any programmer is a search engine
"Don't wish it was easier, wish you were better. Don't wish for less problems, wish for more skills. Don't wish for less challenges, wish for more wisdom" (J. Rohn)
“They did not know it was impossible so they did it” (Mark Twain)
-
Sep 16th, 2020, 10:24 PM
#21
Re: Contest 14 - DnD Dice Roller
Sorry for the late reply, error handling (including invalid syntax) is up to you but I'd appreciate if it were included.
-
Sep 17th, 2020, 03:58 AM
#22
Re: Contest 14 - DnD Dice Roller
Don't worry for the delay, it has been included anyway. Did you get my entry ? (as nothing appears, I don't know if it worked)
The best friend of any programmer is a search engine
"Don't wish it was easier, wish you were better. Don't wish for less problems, wish for more skills. Don't wish for less challenges, wish for more wisdom" (J. Rohn)
“They did not know it was impossible so they did it” (Mark Twain)
-
Sep 17th, 2020, 08:42 AM
#23
Re: Contest 14 - DnD Dice Roller
Yes, the threads go into the moderator approval queue (similar to when new members post) and then from there we move it to a private moderator forum. Once the deadline is met, we move them back to the contest entries forum.
This is so that other members can't see/study existing submissions until after the contest has ended.
-
Sep 29th, 2020, 04:41 AM
#24
Junior Member
Re: Contest 14 - DnD Dice Roller
@dday9, how many entries so far?
On the bright side, I've still got pessimism and despair to fall back on.
-
Sep 29th, 2020, 08:17 AM
#25
Re: Contest 14 - DnD Dice Roller
2
-
Sep 30th, 2020, 02:40 AM
#26
Re: Contest 14 - DnD Dice Roller
I wonder of those who have read these contest posts actually know what is required in terms of possible input and output? I know nothing about Dungeons Dragons and had an idea what the input will be (until I saw + !) but I don't what format of output is required eg post #5 1D% + 1D10 where does + come into this, how does rolling 2 die get one number etc. I'm not entering as this time C++ isn't an accepted language (fair enough) but if I was, I'd be asking for much more info.
Has this put some off?
All advice is offered in good faith only. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
Sep 30th, 2020, 02:53 AM
#27
Re: Contest 14 - DnD Dice Roller
Originally Posted by 2kaud
I wonder of those who have read these contest posts actually know what is required in terms of possible input and output? I know nothing about Dungeons Dragons and had an idea what the input will be (until I saw + !) but I don't what format of output is required eg post #5 1D% + 1D10 where does + come into this, how does rolling 2 die get one number etc. I'm not entering as this time C++ isn't an accepted language (fair enough) but if I was, I'd be asking for much more info.
Has this put some off?
Plus just means "and" in the colloquial sense, e.g. "1 and 1 is 2". Therefore "1D% + 1D10" means "one roll of the percentage die and one roll of the ten-sided die". As was explained earlier, the percentage die would yield a number in the range {0, 10, 20, ..., 90} and the ten-sided die would yield a number in the range 1-10 so adding those together yields a number on the range 1-100. As I have no experience with D&D, there's apparently none needed. That said, that doesn't seem to be part of this contest anyway, so it's a moot point.
-
Sep 30th, 2020, 03:13 AM
#28
Re: Contest 14 - DnD Dice Roller
I have seen only one time a dice with 100 faces and it is not practical.
In game to have a % we use two 10-faced dices (with different colors), one for the tenth and one for the unity and assemble them. Sometime, the dice for the tenth is written with 10 , 20, 30, etc instead of 1, 2, 3, ...
example : throw 2 dices, one blue and one red, decide that the blue is the tenth, the blue give 5 and the red give 8, the result is 58
Last edited by Delaney; Oct 1st, 2020 at 09:58 AM.
The best friend of any programmer is a search engine
"Don't wish it was easier, wish you were better. Don't wish for less problems, wish for more skills. Don't wish for less challenges, wish for more wisdom" (J. Rohn)
“They did not know it was impossible so they did it” (Mark Twain)
-
Sep 30th, 2020, 10:58 AM
#29
Junior Member
Re: Contest 14 - DnD Dice Roller
Originally Posted by dday9
2
Heh, at least we both get a guaranteed podium finish Sweet.
On the bright side, I've still got pessimism and despair to fall back on.
-
Sep 30th, 2020, 11:07 AM
#30
Junior Member
Re: Contest 14 - DnD Dice Roller
Originally Posted by 2kaud
Has this put some off?
It's just a bit of fun. Just get the job done in any way you like. My own C# entry doesn't even conform to the rules as they are given (the 3rd party hosting sites do not offer commandline argument features).
If you want to do a C++ version then go for it. We'll get it built and run it so it can be fairly judged against the other entries.
On the bright side, I've still got pessimism and despair to fall back on.
-
Sep 30th, 2020, 11:10 AM
#31
Re: Contest 14 - DnD Dice Roller
Yeah, my C++ isn't the sharpest, but I could certainly judge it if you wanted to submit an entry.
-
Sep 30th, 2020, 11:57 AM
#32
Re: Contest 14 - DnD Dice Roller
Originally Posted by jmcilhinney
Plus just means "and" in the colloquial sense, e.g. "1 and 1 is 2". Therefore "1D% + 1D10" means "one roll of the percentage die and one roll of the ten-sided die". As was explained earlier, the percentage die would yield a number in the range {0, 10, 20, ..., 90} and the ten-sided die would yield a number in the range 1-10 so adding those together yields a number on the range 1-100. As I have no experience with D&D, there's apparently none needed. That said, that doesn't seem to be part of this contest anyway, so it's a moot point.
It means that if + (and - and x[*] and / and brackets) are allowed as per Wikipedia definition https://en.wikipedia.org/wiki/Dice_notation then you're got a different ballgame than just treating each roll as separate. An example given is 3x(2d6+4) which produces one number. This is what I meant when I said that the problem wasn't well defined.
In the original overview in post #1, 1D% + 1D10 is an invalid input. 1D% 1D10 would give an output like:
1D% - 60
1D10 - 7
but if arithmetic operators are required, then if the die rolled the same then 1D% + D10 is a valid input and would give the single number 67.
?????????????????????
All advice is offered in good faith only. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
Sep 30th, 2020, 12:11 PM
#33
Re: Contest 14 - DnD Dice Roller
I think replies 12 and 13 might clear it up a bit for you.
-
Sep 30th, 2020, 01:59 PM
#34
Junior Member
Re: Contest 14 - DnD Dice Roller
Originally Posted by 2kaud
if the die rolled the same then 1D% + D10 is a valid input and would give the single number 67.
?????????????????????
Does it make any coherent sense to add a 1% resolution value to a 10% resolution value?
On the bright side, I've still got pessimism and despair to fall back on.
-
Oct 1st, 2020, 02:22 AM
#35
Re: Contest 14 - DnD Dice Roller
According to the actual dice rules for DnD - yes. See posts #5, #12 and the wikipedia link.
Although as dday9 points out in post #13 this isn't expected for this contest.
All advice is offered in good faith only. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
Oct 1st, 2020, 07:08 AM
#36
Junior Member
Re: Contest 14 - DnD Dice Roller
Originally Posted by 2kaud
According to the actual dice rules for DnD - yes. See posts #5, #12 and the wikipedia link.
Although as dday9 points out in post #13 this isn't expected for this contest.
What an odd game.
On the bright side, I've still got pessimism and despair to fall back on.
-
Oct 1st, 2020, 07:16 AM
#37
Re: Contest 14 - DnD Dice Roller
Originally Posted by dday9
Yeah, my C++ isn't the sharpest, but I could certainly judge it if you wanted to submit an entry.
Humble effort submitted.
All advice is offered in good faith only. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
Oct 1st, 2020, 08:23 AM
#38
Re: Contest 14 - DnD Dice Roller
Originally Posted by wossy
What an odd game.
How else should it work?You have two d10 dice.... one is for the tens, the other the ones.... you roll one, get the tens place, roll the other, get the ones place... add them together. The 1d% is simply the d10 that's designated as the tens place.
So yeah, you need to roll both and add them. That's how you get a value from 0-99... depending on the situation the double naught is ends up being 100% so you go from 1-100.
-tg
-
Oct 2nd, 2020, 02:19 AM
#39
Junior Member
Re: Contest 14 - DnD Dice Roller
I misunderstood 1d% and thought it to be equivalent to the pair of percentage dice considered together as an atomic roll 0-99. Adding d10 to that would give values between 1-109.
On the bright side, I've still got pessimism and despair to fall back on.
-
Oct 5th, 2020, 07:26 AM
#40
Junior Member
Re: Contest 14 - DnD Dice Roller
Since the momentous occasion of the deadline for this illustrious struggle of wits has now elapsed, has the dedicated team of expert judges had enough time to reach a conclusion?
I've yet to see any white smoke coming from dday9's chimney
I'm not desperate to know or anything, it's just that this contest is the only thing that can save 2020 from being an unmitigated disaster for everyone.
On the bright side, I've still got pessimism and despair to fall back on.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|