0 purchases
craps domain
๐ฒ ๐ฒ Craps Domain #
Core Craps Logic
Craps library that provides the components and game play for craps, the casino game. This is intended to be the core elements that allows creators to make the craps UI without having to build out the components
Installation ๐ป #
Add craps_domain to your pubspec.yaml:
dependencies:
craps_domain:
copied to clipboard
Install it:
dart pub get
copied to clipboard
Running Tests ๐งช #
To run all unit tests:
dart pub global activate coverage 1.2.0
dart test --coverage=coverage
dart pub global run coverage:format_coverage --packages=.dart_tool/package_config.json --check-ignore --report-on=lib --lcov -o ./coverage/lcov.info -i ./coverage
copied to clipboard
To view the generated coverage report you can use lcov.
# Generate Coverage Report
genhtml -o ./coverage/report ./coverage/lcov.info
# Open Coverage Report
open ./coverage/report/index.html
copied to clipboard
Simulate 10 rolls ๐ฒ ๐ฒ #
import 'package:craps_domain/craps_domain.dart';
void main() {
final dice = Dice.generic();
final puck = Puck();
for (var i = 1; i < 11; i++) {
final roll = dice.roll();
roll.log();
puck.evalRoll(roll.value);
}
}
copied to clipboard
...should return ...
Connecting to VM Service at http://127.0.0.1:64072/P2Op5b6-B1s=/
[log] Roll: 7 - <5, 2>
[log] Front line Winner!
[log] Roll: 4 - <3, 1>
[log] (4); Mark the point
[log] Roll: 7 - <4, 3>
[log] Seven out; take the line; pay behind
[log] Roll: 6 - <2, 4>
[log] (6); Mark the point
[log] Roll: 6 - <3, 3>
[log] Point Made (6); pay the line
[log] Roll: 11 - <6, 5>
[log] Front line Winner!
[log] Roll: 6 - <5, 1>
[log] (6); Mark the point
[log] Roll: 7 - <4, 3>
[log] Seven out; take the line; pay behind
[log] Roll: 11 - <6, 5>
[log] Front line Winner!
[log] Roll: 5 - <2, 3>
[log] (5); Mark the point
Exited
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.