CodingTrain / CodingTrain/Suggestion-Box

math expression parser with dice notation!

Open
#1,719 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
570
Forks
85
PR merge metrics
No merged PRs in 30d

Description

I think a fun coding challenge would be to create a math expression parser that could support dice notation.

The simplest implementation would probably just support:
- add/subtract
- multiply/divide
- basic dice notation (dX/AdX)

however, a more advanced implementation might also support:
- parenthesis
- keep/drop dice notation (AdX[k/d]Y...)

Some dice notation examples:
- d20 <- roll 1 twenty sided die.
- 3d4 <- roll 3 four sided dice, and add them together.
- 4d6k3 <- roll 4 six sided dice, keep the three highest rolls and add them together. (used in d&d5e to generate base stats)
- 5d8d2 <- roll 5 eight sided dice, drop the highest two rolls, and add the rest together.
- 6d10k4d2 <- roll 6 ten sided dice, drop the two lowest rolls, drop the two highest rolls, and add the rest together.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.