tnthomas / prem Goto Github PK
View Code? Open in Web Editor NEWA dice calculator that also knows about cards
Home Page: https://prem-calc.vercel.app
License: GNU General Public License v3.0
A dice calculator that also knows about cards
Home Page: https://prem-calc.vercel.app
License: GNU General Public License v3.0
File evaluators/order3/mult.ts
containing evalMult(src: string, node: TreeCursor)
, which is documented and passes the following tests:
File evaluators/order3/mod.ts
containing evalMod(src: string, node: TreeCursor)
, which is documented and passes the following tests:
Comparison operators should be able to use the ArithmeticBinary evaluator under the hood, as comparisons in PREM need to behave a little differently from what you'd expect in a programming language:
Consider the expression output d20 == 20
.
If PREM behaved like an ordinary programming language, it would probably coerce the right side to a Sequence and then compare the Sequences by value. Effectively, it would ask "Is the possibility space of a d20 equal to the Sequence {20}
?". I don't think this is terribly useful.
Instead, we should distribute the equality test over the die values the same way we would with a math operator, and return the Sequence of results. This way, we're asking "Does a d20 roll a 20?", or in D&D terms, "Did I crit?" Way more useful.
The same goes if we have a Sequence, Dice, or Cards on both sides. In Feng Shui, for instance, you get extra benefits for achieving perfect balance when your yin d6 and your yang d6 roll the same number. This test can be written as output d6 == d6
if we distribute comparisons across sequences.
File evaluators/order3/div.ts
containing evalDiv(src: string, node: TreeCursor)
, which is documented and passes the following tests:
File evaluators/order2/not.ts
containing evalNot(src: string, node: TreeCursor)
, which is documented and passes the following tests:
output !0
yields [ { name: "Output", value: [1] } ]
output !1
yields [ { name: "Output", value: [0] } ]
output !!4
yields [ { name: "Output", value: [1] } ]
output !{1, 0, 5}
evaluates to [ { name: "Output", value: [0, 0, 1] } ]
ex: output 2 * 2
File evaluators/order2/negative.ts
containing evalNegative(src: string, node: TreeCursor)
, which is documented and passes the following tests:
output -2
yields [ { name: "Output", value: [-2] } ]
output --1
is not allowed (-- is reserved for possible decrement operator)output -0
yields [ { name: "Output", value: [0] } ]
Moderately large outputs overflow the set-cookie header. Ex: output 2d2d6
A file evaluators/order1/parenExpression.ts
that contains a function evalParenExpression(src: string, node: TreeCursor)
, which should pass the following tests:
output (42)
)output (1c2)c4
)output 1d(2d4)
)Add support for a foreach-type loop block
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.