Update readme and fix flake build

main
mat ess 2023-08-13 18:05:42 -04:00
parent 774e97260a
commit 84def6f0b3
3 changed files with 46 additions and 29 deletions

1
.gitignore vendored
View File

@ -8,3 +8,4 @@ __pycache__
.coverage .coverage
.hypothesis .hypothesis
.direnv .direnv
result

View File

@ -6,26 +6,38 @@ for initiative!
```bash ```bash
$ roll 2d20 $ roll 2d20
1 ..... 15 throwing 2d20:
2 ..... 9 1: ┆ 8
total | 24 2: ┆ 6
total: ╰╶╶ 14
$ roll 5d4+2 $ roll 5d4+2
1 ..... 2 throwing 5d4+2:
2 ..... 2 1: ┆ 3
3 ..... 4 2: ┆ 4
4 ..... 1 3: ┆ 2
5 ..... 3 4: ┆ 4
mod .. +2 5: ┆ 1
total | 14 mod: ┆ +2
total: ╰╶╶ 16
$ roll # defaults to 1d20
throwing 1d20:
1: ┆ 20
total: ╰╶╶ 20
critical hit!
$ roll advantage # or roll adv, roll a
throwing 2d20 with advantage:
1: ┆ 3
2: ┆ 14
total: ╰╶╶ 14
$ roll disadvantage # or roll dis, roll d
throwing 2d20 with disadvantage:
1: ┆ 1
2: ┆ 19
total: ╰╶╶╶ 1
critical miss!
$ roll 1d20
1 ..... 1
total | 1
``` ```
## todo
- [x] roll with (dis)advantage
- [x] print criticals
- [x] use property testing

View File

@ -15,11 +15,22 @@
systems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin" ]; systems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin" ];
perSystem = { config, self', inputs', pkgs, system, ... }: perSystem = { config, self', inputs', pkgs, system, ... }:
let let
package = pkgs.python3.pkgs.buildPythonApplication { buildPkgs = builtins.attrValues {
inherit (pkgs.python311Packages)
hatchling
tomli
;
hatch = pkgs.hatch.override {
python3 = pkgs.python311;
};
};
package = pkgs.python311.pkgs.buildPythonApplication {
pname = "roll"; pname = "roll";
version = "0.1.0"; version = "0.1.0";
src = ./.; src = ./.;
format = "pyproject"; format = "pyproject";
nativeBuildInputs = buildPkgs;
}; };
in in
{ {
@ -35,15 +46,7 @@
${config.pre-commit.installationScript} ${config.pre-commit.installationScript}
echo "welcome to your python project >~(:)=====--" 1>&2 echo "welcome to your python project >~(:)=====--" 1>&2
''; '';
nativeBuildInputs = builtins.attrValues { nativeBuildInputs = buildPkgs;
inherit (pkgs.python311Packages)
hatchling
tomli
;
hatch = pkgs.hatch.override {
python3 = pkgs.python311;
};
};
buildInputs = builtins.attrValues { buildInputs = builtins.attrValues {
inherit (pkgs) inherit (pkgs)
autoflake autoflake
@ -54,6 +57,7 @@
inherit (pkgs.python311Packages) inherit (pkgs.python311Packages)
ipython ipython
; ;
roll = package;
}; };
}; };
}; };