Results 1 to 23 of 23

Thread: Contest 14 - DnD Dice Roller

  1. #1

    Thread Starter
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    9,689

    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:
    Code:
    1D20 - 16
    1d% - 60


    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:
      1. 4-sided
      2. 6-sided
      3. 8-sided
      4. 10-sided
      5. 12-sided
      6. 20-sided
      7. 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.

  2. #2
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005
    Posts
    2,222

    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

    ?

  3. #3

    Thread Starter
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    9,689

    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).

  4. #4
    New Member wossy's Avatar
    Join Date
    Aug 2020
    Posts
    9

    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.
    Sandpapertm

  5. #5

    Thread Starter
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    9,689

    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.

  6. #6
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    32,978

    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
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  7. #7
    New Member wossy's Avatar
    Join Date
    Aug 2020
    Posts
    9

    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.
    Sandpapertm

  8. #8

    Thread Starter
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    9,689

    Re: Contest 14 - DnD Dice Roller

    I shall be the DM of this competition and will thoroughly feed my beholders as I see fit.

  9. #9
    New Member wossy's Avatar
    Join Date
    Aug 2020
    Posts
    9

    Re: Contest 14 - DnD Dice Roller

    Ouch, looks like I need to roll a constitution save.
    Sandpapertm

  10. #10
    New Member wossy's Avatar
    Join Date
    Aug 2020
    Posts
    9

    Re: Contest 14 - DnD Dice Roller

    Submitted my lame attempt at an entry
    Sandpapertm

  11. #11

    Thread Starter
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    9,689

    Re: Contest 14 - DnD Dice Roller

    Got it!

  12. #12

  13. #13

    Thread Starter
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    9,689

    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).

  14. #14
    New Member wossy's Avatar
    Join Date
    Aug 2020
    Posts
    9

    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.
    Sandpapertm

  15. #15
    Hyperactive Member Delaney's Avatar
    Join Date
    Nov 2019
    Location
    Paris, France
    Posts
    346

    Re: Contest 14 - DnD Dice Roller

    What do you mean by
    "include a fiddle(ideone, dotnetfiddle, codepen, etc.)"
    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)

  16. #16

    Thread Starter
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    9,689

    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:
    1. Go to the website
    2. Specify the language: C#, VB.NET, or F#
    3. Copy/paste your code in the text editor
    4. 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

  17. #17
    Hyperactive Member Delaney's Avatar
    Join Date
    Nov 2019
    Location
    Paris, France
    Posts
    346

    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)

  18. #18

    Thread Starter
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    9,689

    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).

  19. #19
    Hyperactive Member Delaney's Avatar
    Join Date
    Nov 2019
    Location
    Paris, France
    Posts
    346

    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)

  20. #20
    Hyperactive Member Delaney's Avatar
    Join Date
    Nov 2019
    Location
    Paris, France
    Posts
    346

    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)

  21. #21

    Thread Starter
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    9,689

    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.

  22. #22
    Hyperactive Member Delaney's Avatar
    Join Date
    Nov 2019
    Location
    Paris, France
    Posts
    346

    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)

  23. #23

    Thread Starter
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    9,689

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width