From 06a0a14bf02b8df4766ce9b18f190da103acedbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=ED=94=84=EB=A6=AC=EB=A7=88?= Date: Sat, 25 Nov 2023 17:47:39 -0400 Subject: [PATCH] tests --- Cargo.lock | 110 +- apps/dice/contract/src/lib.rs | 29 +- apps/dice/contract/tests/src/main.rs | 1 + apps/dice/dice.dart | 360 +-- apps/dice/dice.dib | 57 +- apps/dice/dice.dib.html | 2676 +++++++++--------- apps/dice/dice.dib.ipynb | 2655 +++++++++--------- apps/dice/dice.fsx | 372 +-- apps/dice/dice.php | 670 ++--- apps/dice/dice.py | 430 +-- apps/dice/dice.rs | 523 ++-- apps/dice/dice.spi | 27 +- apps/dice/dice.ts | 393 +-- apps/dice/dice_wasm.rs | 523 ++-- apps/dice/fsharp/dice_fsharp.dib | 4 +- apps/dice/fsharp/dice_fsharp.dib.html | 2 +- apps/dice/fsharp/dice_fsharp.py | 6 +- apps/dice/ui/dice_ui.fsx | 2944 ++++++++++---------- apps/dice/ui/dice_ui_wasm.rs | 3296 ++++++++++++----------- apps/dice/ui/package.json | 2 +- apps/dice/ui/pnpm-lock.yaml | 8 +- apps/dice/ui/src/model/near/backend.rs | 4 +- apps/dice/ui/src/model/near/backend.spi | 10 +- apps/dir-tree-html/DirTreeHtml.dib.html | 2 +- apps/ipfs/package.json | 2 +- apps/ipfs/pnpm-lock.yaml | 8 +- apps/near/explorer_backend_host.txt | 2 +- apps/parser/DibParser.dib.html | 2 +- apps/parser/JsonParser.dib.html | 2 +- apps/parser/Parser.dib.html | 2 +- apps/spiral/Supervisor.dib.html | 1079 ++++---- apps/spiral/Supervisor.dib.ipynb | 1077 ++++---- lib/fsharp/Async.dib.html | 6 +- lib/fsharp/Async.dib.ipynb | 4 +- lib/fsharp/Common.dib.html | 8 +- lib/fsharp/Common.dib.ipynb | 8 +- lib/fsharp/CommonFSharp.dib.html | 2 +- lib/fsharp/Crypto.dib.html | 2 +- lib/fsharp/Threading.dib.html | 2 +- lib/fsharp/Toml.dib.html | 2 +- lib/spiral/am'.dib.html | 141 +- lib/spiral/am'.dib.ipynb | 125 + lib/spiral/leptos.spi | 7 +- lib/spiral/listm'.dib.html | 10 +- lib/spiral/listm'.dib.ipynb | 10 +- lib/spiral/testing.dib | 30 +- lib/spiral/testing.spi | 30 +- 47 files changed, 9495 insertions(+), 8170 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6ced9728..2f537f0c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -591,7 +591,7 @@ dependencies = [ "bytecheck_derive", "ptr_meta", "simdutf8", - "uuid 1.5.0", + "uuid 1.6.1", ] [[package]] @@ -693,9 +693,9 @@ dependencies = [ [[package]] name = "cargo-platform" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12024c4645c97566567129c204f65d5815a8c9aecf30fcbe682b2fe034996d36" +checksum = "e34637b3140142bdf929fb439e8aa4ebad7651ebf7b1080b3930aa16ac1459ff" dependencies = [ "serde", ] @@ -946,9 +946,9 @@ checksum = "f3f6d59c71e7dc3af60f0af9db32364d96a16e9310f3f5db2b55ed642162dd35" [[package]] name = "config" -version = "0.13.3" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d379af7f68bfc21714c6c7dea883544201741d2ce8274bb12fa54f89507f52a7" +checksum = "23738e11972c7643e4ec947840fc463b6a571afcd3e735bdfce7d03c7a784aca" dependencies = [ "async-trait", "lazy_static", @@ -1148,15 +1148,15 @@ dependencies = [ [[package]] name = "data-encoding" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308" +checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5" [[package]] name = "data-encoding-macro" -version = "0.1.13" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c904b33cc60130e1aeea4956ab803d08a3f4a0ca82d64ed757afac3891f2bb99" +checksum = "20c01c06f5f429efdf2bae21eb67c28b3df3cf85b7dd2d8ef09c0838dac5d33e" dependencies = [ "data-encoding", "data-encoding-macro-internal", @@ -1164,9 +1164,9 @@ dependencies = [ [[package]] name = "data-encoding-macro-internal" -version = "0.1.11" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fdf3fce3ce863539ec1d7fd1b6dcc3c645663376b43ed376bbf887733e4f772" +checksum = "0047d07f2c89b17dd631c80450d69841a6b5d7fb17278cbc43d7e4cfcf2576f3" dependencies = [ "data-encoding", "syn 1.0.109", @@ -1404,18 +1404,18 @@ dependencies = [ [[package]] name = "enum-map" -version = "2.7.1" +version = "2.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed40247825a1a0393b91b51d475ea1063a6cbbf0847592e7f13fb427aca6a716" +checksum = "6866f3bfdf8207509a033af1a75a7b08abda06bbaaeae6669323fd5a097df2e9" dependencies = [ "enum-map-derive", ] [[package]] name = "enum-map-derive" -version = "0.15.0" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7933cd46e720348d29ed1493f89df9792563f272f96d8f13d18afe03b32f8cb8" +checksum = "f282cfdfe92516eb26c2af8589c274c7c17681f5ecc03c18255fe741c6aa64eb" dependencies = [ "proc-macro2", "quote", @@ -1443,9 +1443,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c18ee0ed65a5f1f81cac6b1d213b69c35fa47d4252ad41f1486dbd8226fe36e" +checksum = "f258a7194e7f7c2a7837a8913aeab7fd8c383457034fa20ce4dd3dcb813e8eb8" dependencies = [ "libc", "windows-sys", @@ -1493,7 +1493,7 @@ dependencies = [ "regex", "rust_decimal", "startup", - "uuid 1.5.0", + "uuid 1.6.1", ] [[package]] @@ -1571,9 +1571,9 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "form_urlencoded" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" dependencies = [ "percent-encoding", ] @@ -1814,9 +1814,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.21" +version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" +checksum = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178" dependencies = [ "bytes", "fnv", @@ -1824,7 +1824,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap 1.9.3", + "indexmap 2.1.0", "slab", "tokio", "tokio-util 0.7.10", @@ -2060,9 +2060,9 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "idna" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -2354,7 +2354,7 @@ dependencies = [ "server_fn_macro", "syn 2.0.39", "tracing", - "uuid 1.5.0", + "uuid 1.6.1", ] [[package]] @@ -3032,9 +3032,9 @@ checksum = "6540152fba5e96fe5d575b79e8cd244cf2add747bb01362426bdc069bc3a23bc" [[package]] name = "near-sys" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e307313276eaeced2ca95740b5639e1f3125b7c97f0a1151809d105f1aa8c6d3" +checksum = "397688591acf8d3ebf2c2485ba32d4b24fc10aad5334e3ad8ec0b7179bfdf06b" [[package]] name = "near-token" @@ -3250,9 +3250,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl" -version = "0.10.59" +version = "0.10.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a257ad03cd8fb16ad4172fedf8094451e1af1c4b70097636ef2eac9a5f0cc33" +checksum = "79a4c6c3a2b158f7f8f2a2fc5a969fa3a068df6fc9dbb4a43845436e3af7c800" dependencies = [ "bitflags 2.4.1", "cfg-if 1.0.0", @@ -3282,9 +3282,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.95" +version = "0.9.96" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40a4130519a360279579c2053038317e40eff64d13fd3f004f9e1b72b8a6aaf9" +checksum = "3812c071ba60da8b5677cc12bcb1d42989a65553772897a7e0355545a819838f" dependencies = [ "cc", "libc", @@ -3467,9 +3467,9 @@ dependencies = [ [[package]] name = "percent-encoding" -version = "2.3.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "petgraph" @@ -4174,7 +4174,7 @@ dependencies = [ "rkyv_derive", "seahash", "tinyvec", - "uuid 1.5.0", + "uuid 1.6.1", ] [[package]] @@ -4204,9 +4204,9 @@ dependencies = [ [[package]] name = "rust_decimal" -version = "1.33.0" +version = "1.33.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "076ba1058b036d3ca8bcafb1d54d0b0572e99d7ecd3e4222723e18ca8e9ca9a8" +checksum = "06676aec5ccb8fc1da723cc8c0f9a46549f21ebb8753d3915c6c41db1e7f1dc4" dependencies = [ "arrayvec 0.7.4", "num-traits", @@ -4235,9 +4235,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.24" +version = "0.38.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ad981d6c340a49cdc40a1028d9c6084ec7e9fa33fcb839cab656a267071e234" +checksum = "dc99bc2d4f1fed22595588a013687477aedf3cdcfb26558c559edb67b4d9b22e" dependencies = [ "bitflags 2.4.1", "errno", @@ -4248,9 +4248,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.21.8" +version = "0.21.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "446e14c5cda4f3f30fe71863c34ec70f5ac79d6087097ad0bb433e1be5edf04c" +checksum = "629648aced5775d558af50b2b4c7b02983a04b312126d45eeead26e7caa498b9" dependencies = [ "log", "ring", @@ -4441,9 +4441,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.192" +version = "1.0.193" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bca2a08484b285dcb282d0f67b26cadc0df8b19f8c12502c13d966bf9482f001" +checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" dependencies = [ "serde_derive", ] @@ -4472,9 +4472,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.192" +version = "1.0.193" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1" +checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" dependencies = [ "proc-macro2", "quote", @@ -5501,9 +5501,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "ureq" -version = "2.8.0" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5ccd538d4a604753ebc2f17cd9946e89b77bf87f6a8e2309667c6f2e87855e3" +checksum = "f8cdd25c339e200129fe4de81451814e5228c9b771d57378817d6117cc2b3f97" dependencies = [ "base64 0.21.5", "flate2", @@ -5517,9 +5517,9 @@ dependencies = [ [[package]] name = "url" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" +checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" dependencies = [ "form_urlencoded", "idna", @@ -5529,9 +5529,9 @@ dependencies = [ [[package]] name = "utf8-width" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5190c9442dcdaf0ddd50f37420417d219ae5261bbf5db120d0f9bab996c9cba1" +checksum = "86bd8d4e895da8537e5315b8254664e6b769c4ff3db18321b297a1e7004392e3" [[package]] name = "utf8parse" @@ -5547,9 +5547,9 @@ checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" [[package]] name = "uuid" -version = "1.5.0" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88ad59a7560b41a70d191093a945f0b87bc1deeda46fb237479708a1d6b6cdfc" +checksum = "5e395fcf16a7a3d8127ec99782007af141946b4795001f876d54fb0d55978560" dependencies = [ "getrandom 0.2.11", ] @@ -5696,9 +5696,9 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.25.2" +version = "0.25.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" +checksum = "1778a42e8b3b90bff8d0f5032bf22250792889a5cdc752aa0020c84abe3aaf10" [[package]] name = "wee_alloc" diff --git a/apps/dice/contract/src/lib.rs b/apps/dice/contract/src/lib.rs index 83f0a100..eaae5e24 100644 --- a/apps/dice/contract/src/lib.rs +++ b/apps/dice/contract/src/lib.rs @@ -5,25 +5,25 @@ use near_sdk::{env, log, near_bindgen, PanicOnDefault}; pub struct Util {} impl Util { - fn stream_u8_to_u64( + fn stream_u8_to_list( s: fable_library_rust::Native_::LrcPtr, ) -> dice::Dice::UH1 { match s.as_ref() { dice::Dice::UH0::UH0_0(n, f) => { - dice::Dice::UH1::UH1_0(*n, Self::stream_u8_to_u64(f()).into()) + dice::Dice::UH1::UH1_0(*n, Self::stream_u8_to_list(f()).into()) } dice::Dice::UH0::UH0_1 => dice::Dice::UH1::UH1_1, } } - fn stream_u8_to_vec(s: dice::Dice::UH1) -> Vec { - match s { + fn list_u8_to_vec(s: fable_library_rust::Native_::LrcPtr) -> Vec { + match s.as_ref() { dice::Dice::UH1::UH1_0(n, f) => { - let mut v = Self::stream_u8_to_vec(f.as_ref().clone()); - v.push(n); + let mut v = Self::list_u8_to_vec(f.clone()); + v.insert(0, *n); v } - dice::Dice::UH1::UH1_1 => Vec::new(), + dice::Dice::UH1::UH1_1 => vec![], } } @@ -100,7 +100,7 @@ impl State { fable_library_rust::Native_::Func1::new(closure) } - pub fn generate_random_number(&mut self, proof: String, max: u64) -> u64 { + pub fn generate_random_number(&mut self, key: String, proof: String, max: u64) -> u64 { let seed = env::random_seed(); let block_timestamp = env::block_timestamp(); let signer_account_id = env::signer_account_id(); @@ -116,6 +116,7 @@ impl State { account_balance.to_le_bytes().to_vec(), signer_account_id.as_bytes().to_vec(), self.seeds.iter().map(|x| *x).collect::>(), + key.clone().into_bytes(), proof.clone().into_bytes(), ] .concat(); @@ -124,19 +125,19 @@ impl State { self.contribute_seed(hash_u8.clone()); let hash_stream = Util::vec_u8_to_stream(hash_u8.clone()); - let rolls_stream = - Util::stream_u8_to_u64(dice::Dice::rotate_numbers(6)(hash_stream.into())); + let rolls_list = Util::stream_u8_to_list(dice::Dice::rotate_numbers(6)(hash_stream.into())); { - let rolls_stream_log = Util::stream_u8_to_vec(rolls_stream.clone()); + let rolls_list_log = Util::list_u8_to_vec(rolls_list.clone().into()); let signer_account_id_log = signer_account_id.as_str(); - log!(format!("generate_random_number / max: {max:#?} / proof: {proof:?} / block_timestamp: {block_timestamp:#?} / block_height: {block_height:#?} / epoch_height: {epoch_height:#?} / account_balance: {account_balance:#?} / signer_account_id: {signer_account_id_log:?} / seed: {seed:?} / entropy: {entropy:?} / hash_u8: {hash_u8:?} / rolls_stream: {rolls_stream_log:?}")); + log!(format!("generate_random_number / max: {max:#?} / key: {key:?} / proof: {proof:?} / block_timestamp: {block_timestamp:#?} / block_height: {block_height:#?} / epoch_height: {epoch_height:#?} / account_balance: {account_balance:#?} / signer_account_id: {signer_account_id_log:?} / seed: {seed:?} / entropy: {entropy:?} / hash_u8: {hash_u8:?} / rolls_list: {rolls_list_log:?}")); } - let sequential_roll = dice::Dice::create_sequential_roller(rolls_stream.into()); let logger = Self::get_logger(); + let sequential_roll = + dice::Dice::create_sequential_roller(Some(logger.clone()))(rolls_list.into()); let result = - dice::Dice::roll_progressively(Some(logger.clone()))(sequential_roll)(false)(max); + dice::Dice::roll_progressively(Some(logger.clone()))(sequential_roll)(true)(max); logger("".into()); result as u64 } diff --git a/apps/dice/contract/tests/src/main.rs b/apps/dice/contract/tests/src/main.rs index 9bdb77c7..c45b6c63 100644 --- a/apps/dice/contract/tests/src/main.rs +++ b/apps/dice/contract/tests/src/main.rs @@ -95,6 +95,7 @@ async fn main() -> anyhow::Result<()> { let result = contract .call("generate_random_number") .args_json(json!({ + "key": "key", "proof": "proof", "max": 2000, })) diff --git a/apps/dice/dice.dart b/apps/dice/dice.dart index abf266a8..13e234d9 100644 --- a/apps/dice/dice.dart +++ b/apps/dice/dice.dart @@ -1,6 +1,7 @@ // ignore_for_file: camel_case_types, constant_identifier_names, non_constant_identifier_names, unnecessary_this import './fable_modules/fable_library/Option.dart' as option_47; import './fable_modules/fable_library/Random.dart' as random; +import './fable_modules/fable_library/String.dart' as string; import './fable_modules/fable_library/Types.dart' as types; import './fable_modules/fable_library/Util.dart' as util; @@ -48,23 +49,33 @@ class UH1_UH1_0 extends UH1 { } } -abstract class US0 implements types.Union { +class US0 implements types.Union { final int tag; const US0(this.tag); } -class US0_US0_0 extends US0 { +class US0_US0_1 extends US0 { + final void Function(String) f1_0; + const US0_US0_1(this.f1_0): super(1); +} + +abstract class US1 implements types.Union { + final int tag; + const US1(this.tag); +} + +class US1_US1_0 extends US1 { final UH0 f0_0; - const US0_US0_0(this.f0_0): super(0); + const US1_US1_0(this.f0_0): super(0); } -class US0_US0_1 extends US0 { +class US1_US1_1 extends US1 { final UH0 Function() f1_0; - const US0_US0_1(this.f1_0): super(1); + const US1_US1_1(this.f1_0): super(1); } class Mut0 implements types.Record { - US0 l0; + US1 l0; Mut0(this.l0); } @@ -79,27 +90,27 @@ class Mut1 implements types.Record, Comparable { int compareTo(Mut1 other) => l0.compareTo(other.l0); } -class US1 implements types.Union, Comparable { +class US2 implements types.Union, Comparable { final int tag; - const US1(this.tag); + const US2(this.tag); @override - bool operator ==(Object other) => (other is US1) && (other.tag == tag); + bool operator ==(Object other) => (other is US2) && (other.tag == tag); @override int get hashCode => tag.hashCode; @override - int compareTo(US1 other) => tag.compareTo(other.tag); + int compareTo(US2 other) => tag.compareTo(other.tag); } -class US1_US1_1 extends US1 { +class US2_US2_1 extends US2 { final int f1_0; - const US1_US1_1(this.f1_0): super(1); + const US2_US2_1(this.f1_0): super(1); @override - bool operator ==(Object other) => (other is US1_US1_1) && (other.f1_0 == f1_0); + bool operator ==(Object other) => (other is US2_US2_1) && (other.f1_0 == f1_0); @override int get hashCode => util.combineHashCodes([tag.hashCode, f1_0.hashCode]); @override - int compareTo(US1 other) { - if (other is US1_US1_1) { + int compareTo(US2 other) { + if (other is US2_US2_1) { return f1_0.compareTo(other.f1_0); } else { return tag.compareTo(other.tag); @@ -107,14 +118,15 @@ class US1_US1_1 extends US1 { } } -class US2 implements types.Union { - final int tag; - const US2(this.tag); -} - -class US2_US2_1 extends US2 { - final void Function(String) f1_0; - const US2_US2_1(this.f1_0): super(1); +class Mut2 implements types.Record, Comparable { + US2 l0; + Mut2(this.l0); + @override + bool operator ==(Object other) => (other is Mut2) && (other.l0 == l0); + @override + int get hashCode => l0.hashCode; + @override + int compareTo(Mut2 other) => l0.compareTo(other.l0); } class US3 implements types.Union, Comparable { @@ -239,6 +251,8 @@ UH0 closure1(int v0_1, UH0 v1_1) => method0(v0_1, v1_1, const UH0(/* UH0_1 */ 1) UH0 Function(UH0) closure0(void unitVar, int v0_1) => (UH0 v) => closure1(v0_1, v); +US0 closure4(void unitVar, void Function(String) v0_1) => US0_US0_1(v0_1); + UH1 method1(UH1 v0_1_mut, UH1 v1_1_mut) { method1: while (true) { @@ -264,7 +278,7 @@ UH1 method2(UH1 v0_1, UH1 v1_1) { } } -UH0 closure4(UH0 v0_1, void unitVar) => v0_1; +UH0 closure6(UH0 v0_1, void unitVar) => v0_1; UH0 method3(UH1 v0_1, UH0 v1_1) { if (v0_1.tag == /* UH1_1 */ 1) { @@ -272,16 +286,16 @@ UH0 method3(UH1 v0_1, UH0 v1_1) { } else { final v0_1_1 = v0_1 as UH1_UH1_0; final UH0 v4_1 = method3(v0_1_1.Item2, v1_1); - return UH0_UH0_0(v0_1_1.Item1, () => closure4(v4_1, util.ignore())); + return UH0_UH0_0(v0_1_1.Item1, () => closure6(v4_1, util.ignore())); } } -UH0 closure5(UH0 v0_1, void unitVar) => v0_1; +UH0 closure7(UH0 v0_1, void unitVar) => v0_1; -UH0 closure6(UH0 v0_1, Mut0 v1_1, void unitVar) { - final US0 v2_1 = v1_1.l0; - if (v2_1.tag == /* US0_1 */ 1) { - final v2_1_1 = v2_1 as US0_US0_1; +UH0 closure8(UH0 v0_1, Mut0 v1_1, void unitVar) { + final US1 v2_1 = v1_1.l0; + if (v2_1.tag == /* US1_1 */ 1) { + final v2_1_1 = v2_1 as US1_US1_1; final UH0 v5 = v2_1_1.f1_0(); late final UH0 v12; if (v5.tag == /* UH0_1 */ 1) { @@ -290,29 +304,29 @@ UH0 closure6(UH0 v0_1, Mut0 v1_1, void unitVar) { final v5_1 = v5 as UH0_UH0_0; v12 = UH0_UH0_0(v5_1.Item1, method4(v0_1, v5_1.Item2)); } - v1_1.l0 = US0_US0_0(v12); + v1_1.l0 = US1_US1_0(v12); return v12; } else { - final v2_1_2 = v2_1 as US0_US0_0; + final v2_1_2 = v2_1 as US1_US1_0; return v2_1_2.f0_0; } } UH0 Function() method4(UH0 v0_1, UH0 Function() v1_1) { - final v3_1 = Mut0(US0_US0_1(v1_1)); - return () => closure6(v0_1, v3_1, util.ignore()); + final v3_1 = Mut0(US1_US1_1(v1_1)); + return () => closure8(v0_1, v3_1, util.ignore()); } -US1 method6(int v0_1_mut, UH0 v1_1_mut) { +US2 method6(int v0_1_mut, UH0 v1_1_mut) { method6: while (true) { final v0_1 = v0_1_mut; final UH0 v1_1 = v1_1_mut; if (v1_1.tag == /* UH0_1 */ 1) { - return const US1(/* US1_0 */ 0); + return const US2(/* US2_0 */ 0); } else if (v0_1 <= 0) { final v1_1_1 = v1_1 as UH0_UH0_0; - return US1_US1_1(v1_1_1.Item1); + return US2_US2_1(v1_1_1.Item1); } else { v0_1_mut = v0_1 - 1; final v1_1_2 = v1_1 as UH0_UH0_0; @@ -322,55 +336,79 @@ US1 method6(int v0_1_mut, UH0 v1_1_mut) { } } -int method5(UH0 Function() v0_1_mut, Mut1 v1_1_mut, Mut1 v2_1_mut, Mut1 v3_1_mut) { +int method5(US0 v0_1_mut, UH0 Function() v1_1_mut, Mut1 v2_1_mut, Mut1 v3_1_mut, Mut1 v4_1_mut, Mut2 v5_mut) { method5: while (true) { - final v0_1 = v0_1_mut; + final US0 v0_1 = v0_1_mut; final v1_1 = v1_1_mut; final v2_1 = v2_1_mut; final v3_1 = v3_1_mut; - final UH0 v4_1 = v0_1(); - final US1 v6 = method6(v1_1.l0, v4_1); - if (v6.tag == /* US1_1 */ 1) { - final v9 = v1_1.l0 + 1; - v1_1.l0 = v9; - final v6_1 = v6 as US1_US1_1; - return v6_1.f1_0; + final v4_1 = v4_1_mut; + final v5 = v5_mut; + final v10 = string.toText(string.interpolate('create_sequential_roller / roll / current_index: %P() / acc: %P() / len: %P() / last_item: %A%P()', [v2_1.l0, v3_1.l0, v4_1.l0, v5.l0])); + if (v0_1.tag == /* US0_1 */ 1) { + final v0_1_1 = v0_1 as US0_US0_1; + v0_1_1.f1_0(v10); + } + final UH0 v12 = v1_1(); + final US2 v14 = method6(v2_1.l0, v12); + if (v14.tag == /* US2_1 */ 1) { + final v14_1 = v14 as US2_US2_1; + final v15 = v14_1.f1_0; + final v17 = v2_1.l0 + 1; + v2_1.l0 = v17; + v5.l0 = US2_US2_1(v15); + return v15; } else { - if (v3_1.l0 == (-1)) { - final v12 = v1_1.l0; - v3_1.l0 = v12; + if (v0_1.tag == /* US0_1 */ 1) { + final v0_1_2 = v0_1 as US0_US0_1; + v0_1_2.f1_0('create_sequential_roller / roll / None'); } - final v18 = (v2_1.l0 >= v3_1.l0) ? 1 : (v2_1.l0 + 1); - v2_1.l0 = v18; - final v20 = v2_1.l0 - 1; - v1_1.l0 = v20; + if (v4_1.l0 == (-1)) { + final v23 = v2_1.l0; + v4_1.l0 = v23; + } + final v29 = (v3_1.l0 >= v4_1.l0) ? 1 : (v3_1.l0 + 1); + v3_1.l0 = v29; + final v31 = v3_1.l0 - 1; + v2_1.l0 = v31; + v5.l0 = const US2(/* US2_0 */ 0); v0_1_mut = v0_1; v1_1_mut = v1_1; v2_1_mut = v2_1; v3_1_mut = v3_1; + v4_1_mut = v4_1; + v5_mut = v5; continue method5; } } } -int closure7(UH0 Function() v0_1, Mut1 v1_1, Mut1 v2_1, Mut1 v3_1, void unitVar) => method5(v0_1, v1_1, v2_1, v3_1); +int closure9(US0 v0_1, UH0 Function() v1_1, Mut1 v2_1, Mut1 v3_1, Mut1 v4_1, Mut2 v5, void unitVar) => method5(v0_1, v1_1, v2_1, v3_1, v4_1, v5); -int Function() closure3(void unitVar, UH1 v0_1) { - final UH0 v5 = method3(method2(v0_1, method1(v0_1, const UH1(/* UH1_1 */ 1))), const UH0(/* UH0_1 */ 1)); - final v7 = method4(v5, () => closure5(v5, util.ignore())); - final v8 = Mut1(0); - final v9 = Mut1(1); - final v10 = Mut1(-1); - return () => closure7(v7, v8, v9, v10, util.ignore()); +int Function() closure5(US0 v0_1, UH1 v1_1) { + if (v0_1.tag == /* US0_1 */ 1) { + final v0_1_1 = v0_1 as US0_US0_1; + v0_1_1.f1_0('create_sequential_roller ()'); + } + final UH0 v8 = method3(method2(v1_1, method1(v1_1, const UH1(/* UH1_1 */ 1))), const UH0(/* UH0_1 */ 1)); + final v10 = method4(v8, () => closure7(v8, util.ignore())); + final v11 = Mut1(0); + final v12 = Mut1(1); + final v13 = Mut1(-1); + final v15 = Mut2(const US2(/* US2_0 */ 0)); + return () => closure9(v0_1, v10, v11, v12, v13, v15, util.ignore()); } -US2 closure9(void unitVar, void Function(String) v0_1) => US2_US2_1(v0_1); +int Function() Function(UH1) closure3(void unitVar, types.Some? v0_1) { + final US0 v3_1 = option_47.defaultValue(const US0(/* US0_0 */ 0), option_47.map((void Function(String) v) => closure4(util.ignore(), v), v0_1)); + return (UH1 v_1) => closure5(v3_1, v_1); +} -int method7(US2 v0_1_mut, int v1_1_mut, int v2_1_mut, int v3_1_mut) { +int method7(US0 v0_1_mut, int v1_1_mut, int v2_1_mut, int v3_1_mut) { method7: while (true) { - final US2 v0_1 = v0_1_mut; + final US0 v0_1 = v0_1_mut; final v1_1 = v1_1_mut; final v2_1 = v2_1_mut; final v3_1 = v3_1_mut; @@ -384,16 +422,16 @@ int method7(US2 v0_1_mut, int v1_1_mut, int v2_1_mut, int v3_1_mut) { continue method7; } else { final v9 = 'calculate_dice_count / max: $v1_1 / n: $v2_1 / p: $v3_1'; - if (v0_1.tag == /* US2_1 */ 1) { - final v0_1_1 = v0_1 as US2_US2_1; + if (v0_1.tag == /* US0_1 */ 1) { + final v0_1_1 = v0_1 as US0_US0_1; v0_1_1.f1_0(v9); } return v2_1; } } else { final v12 = 'calculate_dice_count / max: $v1_1 / n: $v2_1 / p: $v3_1'; - if (v0_1.tag == /* US2_1 */ 1) { - final v0_1_2 = v0_1 as US2_US2_1; + if (v0_1.tag == /* US0_1 */ 1) { + final v0_1_2 = v0_1 as US0_US0_1; v0_1_2.f1_0(v12); } return v2_1; @@ -401,133 +439,133 @@ int method7(US2 v0_1_mut, int v1_1_mut, int v2_1_mut, int v3_1_mut) { } } -UH2 closure76(void unitVar, void unitVar_1) => UH2_UH2_0(0, () => closure76(util.ignore(), util.ignore())); +UH2 closure77(void unitVar, void unitVar_1) => UH2_UH2_0(0, () => closure77(util.ignore(), util.ignore())); -UH2 closure75(void unitVar, void unitVar_1) => UH2_UH2_0(-9223372036854775808, () => closure76(util.ignore(), util.ignore())); +UH2 closure76(void unitVar, void unitVar_1) => UH2_UH2_0(-9223372036854775808, () => closure77(util.ignore(), util.ignore())); -UH2 closure74(void unitVar, void unitVar_1) => UH2_UH2_0(4611686018427387904, () => closure75(util.ignore(), util.ignore())); +UH2 closure75(void unitVar, void unitVar_1) => UH2_UH2_0(4611686018427387904, () => closure76(util.ignore(), util.ignore())); -UH2 closure73(void unitVar, void unitVar_1) => UH2_UH2_0(6917529027641081856, () => closure74(util.ignore(), util.ignore())); +UH2 closure74(void unitVar, void unitVar_1) => UH2_UH2_0(6917529027641081856, () => closure75(util.ignore(), util.ignore())); -UH2 closure72(void unitVar, void unitVar_1) => UH2_UH2_0(1152921504606846976, () => closure73(util.ignore(), util.ignore())); +UH2 closure73(void unitVar, void unitVar_1) => UH2_UH2_0(1152921504606846976, () => closure74(util.ignore(), util.ignore())); -UH2 closure71(void unitVar, void unitVar_1) => UH2_UH2_0(-2882303761517117440, () => closure72(util.ignore(), util.ignore())); +UH2 closure72(void unitVar, void unitVar_1) => UH2_UH2_0(-2882303761517117440, () => closure73(util.ignore(), util.ignore())); -UH2 closure70(void unitVar, void unitVar_1) => UH2_UH2_0(-6629298651489370112, () => closure71(util.ignore(), util.ignore())); +UH2 closure71(void unitVar, void unitVar_1) => UH2_UH2_0(-6629298651489370112, () => closure72(util.ignore(), util.ignore())); -UH2 closure69(void unitVar, void unitVar_1) => UH2_UH2_0(5044031582654955520, () => closure70(util.ignore(), util.ignore())); +UH2 closure70(void unitVar, void unitVar_1) => UH2_UH2_0(5044031582654955520, () => closure71(util.ignore(), util.ignore())); -UH2 closure68(void unitVar, void unitVar_1) => UH2_UH2_0(6989586621679009792, () => closure69(util.ignore(), util.ignore())); +UH2 closure69(void unitVar, void unitVar_1) => UH2_UH2_0(6989586621679009792, () => closure70(util.ignore(), util.ignore())); -UH2 closure67(void unitVar, void unitVar_1) => UH2_UH2_0(-1909526242005090304, () => closure68(util.ignore(), util.ignore())); +UH2 closure68(void unitVar, void unitVar_1) => UH2_UH2_0(-1909526242005090304, () => closure69(util.ignore(), util.ignore())); -UH2 closure66(void unitVar, void unitVar_1) => UH2_UH2_0(-6467169064904032256, () => closure67(util.ignore(), util.ignore())); +UH2 closure67(void unitVar, void unitVar_1) => UH2_UH2_0(-6467169064904032256, () => closure68(util.ignore(), util.ignore())); -UH2 closure65(void unitVar, void unitVar_1) => UH2_UH2_0(-4152318856435597312, () => closure66(util.ignore(), util.ignore())); +UH2 closure66(void unitVar, void unitVar_1) => UH2_UH2_0(-4152318856435597312, () => closure67(util.ignore(), util.ignore())); -UH2 closure64(void unitVar, void unitVar_1) => UH2_UH2_0(2382404202878992384, () => closure65(util.ignore(), util.ignore())); +UH2 closure65(void unitVar, void unitVar_1) => UH2_UH2_0(2382404202878992384, () => closure66(util.ignore(), util.ignore())); -UH2 closure63(void unitVar, void unitVar_1) => UH2_UH2_0(6545982058383015936, () => closure64(util.ignore(), util.ignore())); +UH2 closure64(void unitVar, void unitVar_1) => UH2_UH2_0(6545982058383015936, () => closure65(util.ignore(), util.ignore())); -UH2 closure62(void unitVar, void unitVar_1) => UH2_UH2_0(-8132375027124273152, () => closure63(util.ignore(), util.ignore())); +UH2 closure63(void unitVar, void unitVar_1) => UH2_UH2_0(-8132375027124273152, () => closure64(util.ignore(), util.ignore())); -UH2 closure61(void unitVar, void unitVar_1) => UH2_UH2_0(4793518853382471680, () => closure62(util.ignore(), util.ignore())); +UH2 closure62(void unitVar, void unitVar_1) => UH2_UH2_0(4793518853382471680, () => closure63(util.ignore(), util.ignore())); -UH2 closure60(void unitVar, void unitVar_1) => UH2_UH2_0(3873377154515337216, () => closure61(util.ignore(), util.ignore())); +UH2 closure61(void unitVar, void unitVar_1) => UH2_UH2_0(3873377154515337216, () => closure62(util.ignore(), util.ignore())); -UH2 closure59(void unitVar, void unitVar_1) => UH2_UH2_0(645562859085889536, () => closure60(util.ignore(), util.ignore())); +UH2 closure60(void unitVar, void unitVar_1) => UH2_UH2_0(645562859085889536, () => closure61(util.ignore(), util.ignore())); -UH2 closure58(void unitVar, void unitVar_1) => UH2_UH2_0(107593809847648256, () => closure59(util.ignore(), util.ignore())); +UH2 closure59(void unitVar, void unitVar_1) => UH2_UH2_0(107593809847648256, () => closure60(util.ignore(), util.ignore())); -UH2 closure57(void unitVar, void unitVar_1) => UH2_UH2_0(3092389647259533312, () => closure58(util.ignore(), util.ignore())); +UH2 closure58(void unitVar, void unitVar_1) => UH2_UH2_0(3092389647259533312, () => closure59(util.ignore(), util.ignore())); -UH2 closure56(void unitVar, void unitVar_1) => UH2_UH2_0(-8707973762311520256, () => closure57(util.ignore(), util.ignore())); +UH2 closure57(void unitVar, void unitVar_1) => UH2_UH2_0(-8707973762311520256, () => closure58(util.ignore(), util.ignore())); -UH2 closure55(void unitVar, void unitVar_1) => UH2_UH2_0(-1451328960385253376, () => closure56(util.ignore(), util.ignore())); +UH2 closure56(void unitVar, void unitVar_1) => UH2_UH2_0(-1451328960385253376, () => closure57(util.ignore(), util.ignore())); -UH2 closure54(void unitVar, void unitVar_1) => UH2_UH2_0(8981483876790566912, () => closure55(util.ignore(), util.ignore())); +UH2 closure55(void unitVar, void unitVar_1) => UH2_UH2_0(8981483876790566912, () => closure56(util.ignore(), util.ignore())); -UH2 closure53(void unitVar, void unitVar_1) => UH2_UH2_0(-4652000711771422720, () => closure54(util.ignore(), util.ignore())); +UH2 closure54(void unitVar, void unitVar_1) => UH2_UH2_0(-4652000711771422720, () => closure55(util.ignore(), util.ignore())); -UH2 closure52(void unitVar, void unitVar_1) => UH2_UH2_0(2299123893656354816, () => closure53(util.ignore(), util.ignore())); +UH2 closure53(void unitVar, void unitVar_1) => UH2_UH2_0(2299123893656354816, () => closure54(util.ignore(), util.ignore())); -UH2 closure51(void unitVar, void unitVar_1) => UH2_UH2_0(3457644661227651072, () => closure52(util.ignore(), util.ignore())); +UH2 closure52(void unitVar, void unitVar_1) => UH2_UH2_0(3457644661227651072, () => closure53(util.ignore(), util.ignore())); -UH2 closure50(void unitVar, void unitVar_1) => UH2_UH2_0(576274110204608512, () => closure51(util.ignore(), util.ignore())); +UH2 closure51(void unitVar, void unitVar_1) => UH2_UH2_0(576274110204608512, () => closure52(util.ignore(), util.ignore())); -UH2 closure49(void unitVar, void unitVar_1) => UH2_UH2_0(6244960376270618624, () => closure50(util.ignore(), util.ignore())); +UH2 closure50(void unitVar, void unitVar_1) => UH2_UH2_0(6244960376270618624, () => closure51(util.ignore(), util.ignore())); -UH2 closure48(void unitVar, void unitVar_1) => UH2_UH2_0(-5108087961858080768, () => closure49(util.ignore(), util.ignore())); +UH2 closure49(void unitVar, void unitVar_1) => UH2_UH2_0(-5108087961858080768, () => closure50(util.ignore(), util.ignore())); -UH2 closure47(void unitVar, void unitVar_1) => UH2_UH2_0(-3925805339261272064, () => closure48(util.ignore(), util.ignore())); +UH2 closure48(void unitVar, void unitVar_1) => UH2_UH2_0(-3925805339261272064, () => closure49(util.ignore(), util.ignore())); -UH2 closure46(void unitVar, void unitVar_1) => UH2_UH2_0(-3728758235495137280, () => closure47(util.ignore(), util.ignore())); +UH2 closure47(void unitVar, void unitVar_1) => UH2_UH2_0(-3728758235495137280, () => closure48(util.ignore(), util.ignore())); -UH2 closure45(void unitVar, void unitVar_1) => UH2_UH2_0(5527454985320660992, () => closure46(util.ignore(), util.ignore())); +UH2 closure46(void unitVar, void unitVar_1) => UH2_UH2_0(5527454985320660992, () => closure47(util.ignore(), util.ignore())); -UH2 closure44(void unitVar, void unitVar_1) => UH2_UH2_0(-2153214848064815104, () => closure45(util.ignore(), util.ignore())); +UH2 closure45(void unitVar, void unitVar_1) => UH2_UH2_0(-2153214848064815104, () => closure46(util.ignore(), util.ignore())); -UH2 closure43(void unitVar, void unitVar_1) => UH2_UH2_0(-6507783832580653056, () => closure44(util.ignore(), util.ignore())); +UH2 closure44(void unitVar, void unitVar_1) => UH2_UH2_0(-6507783832580653056, () => closure45(util.ignore(), util.ignore())); -UH2 closure42(void unitVar, void unitVar_1) => UH2_UH2_0(8138741398091333632, () => closure43(util.ignore(), util.ignore())); +UH2 closure43(void unitVar, void unitVar_1) => UH2_UH2_0(8138741398091333632, () => closure44(util.ignore(), util.ignore())); -UH2 closure41(void unitVar, void unitVar_1) => UH2_UH2_0(7505371590918406144, () => closure42(util.ignore(), util.ignore())); +UH2 closure42(void unitVar, void unitVar_1) => UH2_UH2_0(7505371590918406144, () => closure43(util.ignore(), util.ignore())); -UH2 closure40(void unitVar, void unitVar_1) => UH2_UH2_0(-1823562080465190912, () => closure41(util.ignore(), util.ignore())); +UH2 closure41(void unitVar, void unitVar_1) => UH2_UH2_0(-1823562080465190912, () => closure42(util.ignore(), util.ignore())); -UH2 closure39(void unitVar, void unitVar_1) => UH2_UH2_0(8919445023443910656, () => closure40(util.ignore(), util.ignore())); +UH2 closure40(void unitVar, void unitVar_1) => UH2_UH2_0(8919445023443910656, () => closure41(util.ignore(), util.ignore())); -UH2 closure38(void unitVar, void unitVar_1) => UH2_UH2_0(4561031516192243712, () => closure39(util.ignore(), util.ignore())); +UH2 closure39(void unitVar, void unitVar_1) => UH2_UH2_0(4561031516192243712, () => closure40(util.ignore(), util.ignore())); -UH2 closure37(void unitVar, void unitVar_1) => UH2_UH2_0(-8463200117489401856, () => closure38(util.ignore(), util.ignore())); +UH2 closure38(void unitVar, void unitVar_1) => UH2_UH2_0(-8463200117489401856, () => closure39(util.ignore(), util.ignore())); -UH2 closure36(void unitVar, void unitVar_1) => UH2_UH2_0(4738381338321616896, () => closure37(util.ignore(), util.ignore())); +UH2 closure37(void unitVar, void unitVar_1) => UH2_UH2_0(4738381338321616896, () => closure38(util.ignore(), util.ignore())); -UH2 closure35(void unitVar, void unitVar_1) => UH2_UH2_0(789730223053602816, () => closure36(util.ignore(), util.ignore())); +UH2 closure36(void unitVar, void unitVar_1) => UH2_UH2_0(789730223053602816, () => closure37(util.ignore(), util.ignore())); -UH2 closure34(void unitVar, void unitVar_1) => UH2_UH2_0(131621703842267136, () => closure35(util.ignore(), util.ignore())); +UH2 closure35(void unitVar, void unitVar_1) => UH2_UH2_0(131621703842267136, () => closure36(util.ignore(), util.ignore())); -UH2 closure33(void unitVar, void unitVar_1) => UH2_UH2_0(21936950640377856, () => closure34(util.ignore(), util.ignore())); +UH2 closure34(void unitVar, void unitVar_1) => UH2_UH2_0(21936950640377856, () => closure35(util.ignore(), util.ignore())); -UH2 closure32(void unitVar, void unitVar_1) => UH2_UH2_0(3656158440062976, () => closure33(util.ignore(), util.ignore())); +UH2 closure33(void unitVar, void unitVar_1) => UH2_UH2_0(3656158440062976, () => closure34(util.ignore(), util.ignore())); -UH2 closure31(void unitVar, void unitVar_1) => UH2_UH2_0(609359740010496, () => closure32(util.ignore(), util.ignore())); +UH2 closure32(void unitVar, void unitVar_1) => UH2_UH2_0(609359740010496, () => closure33(util.ignore(), util.ignore())); -UH2 closure30(void unitVar, void unitVar_1) => UH2_UH2_0(101559956668416, () => closure31(util.ignore(), util.ignore())); +UH2 closure31(void unitVar, void unitVar_1) => UH2_UH2_0(101559956668416, () => closure32(util.ignore(), util.ignore())); -UH2 closure29(void unitVar, void unitVar_1) => UH2_UH2_0(16926659444736, () => closure30(util.ignore(), util.ignore())); +UH2 closure30(void unitVar, void unitVar_1) => UH2_UH2_0(16926659444736, () => closure31(util.ignore(), util.ignore())); -UH2 closure28(void unitVar, void unitVar_1) => UH2_UH2_0(2821109907456, () => closure29(util.ignore(), util.ignore())); +UH2 closure29(void unitVar, void unitVar_1) => UH2_UH2_0(2821109907456, () => closure30(util.ignore(), util.ignore())); -UH2 closure27(void unitVar, void unitVar_1) => UH2_UH2_0(470184984576, () => closure28(util.ignore(), util.ignore())); +UH2 closure28(void unitVar, void unitVar_1) => UH2_UH2_0(470184984576, () => closure29(util.ignore(), util.ignore())); -UH2 closure26(void unitVar, void unitVar_1) => UH2_UH2_0(78364164096, () => closure27(util.ignore(), util.ignore())); +UH2 closure27(void unitVar, void unitVar_1) => UH2_UH2_0(78364164096, () => closure28(util.ignore(), util.ignore())); -UH2 closure25(void unitVar, void unitVar_1) => UH2_UH2_0(13060694016, () => closure26(util.ignore(), util.ignore())); +UH2 closure26(void unitVar, void unitVar_1) => UH2_UH2_0(13060694016, () => closure27(util.ignore(), util.ignore())); -UH2 closure24(void unitVar, void unitVar_1) => UH2_UH2_0(2176782336, () => closure25(util.ignore(), util.ignore())); +UH2 closure25(void unitVar, void unitVar_1) => UH2_UH2_0(2176782336, () => closure26(util.ignore(), util.ignore())); -UH2 closure23(void unitVar, void unitVar_1) => UH2_UH2_0(362797056, () => closure24(util.ignore(), util.ignore())); +UH2 closure24(void unitVar, void unitVar_1) => UH2_UH2_0(362797056, () => closure25(util.ignore(), util.ignore())); -UH2 closure22(void unitVar, void unitVar_1) => UH2_UH2_0(60466176, () => closure23(util.ignore(), util.ignore())); +UH2 closure23(void unitVar, void unitVar_1) => UH2_UH2_0(60466176, () => closure24(util.ignore(), util.ignore())); -UH2 closure21(void unitVar, void unitVar_1) => UH2_UH2_0(10077696, () => closure22(util.ignore(), util.ignore())); +UH2 closure22(void unitVar, void unitVar_1) => UH2_UH2_0(10077696, () => closure23(util.ignore(), util.ignore())); -UH2 closure20(void unitVar, void unitVar_1) => UH2_UH2_0(1679616, () => closure21(util.ignore(), util.ignore())); +UH2 closure21(void unitVar, void unitVar_1) => UH2_UH2_0(1679616, () => closure22(util.ignore(), util.ignore())); -UH2 closure19(void unitVar, void unitVar_1) => UH2_UH2_0(279936, () => closure20(util.ignore(), util.ignore())); +UH2 closure20(void unitVar, void unitVar_1) => UH2_UH2_0(279936, () => closure21(util.ignore(), util.ignore())); -UH2 closure18(void unitVar, void unitVar_1) => UH2_UH2_0(46656, () => closure19(util.ignore(), util.ignore())); +UH2 closure19(void unitVar, void unitVar_1) => UH2_UH2_0(46656, () => closure20(util.ignore(), util.ignore())); -UH2 closure17(void unitVar, void unitVar_1) => UH2_UH2_0(7776, () => closure18(util.ignore(), util.ignore())); +UH2 closure18(void unitVar, void unitVar_1) => UH2_UH2_0(7776, () => closure19(util.ignore(), util.ignore())); -UH2 closure16(void unitVar, void unitVar_1) => UH2_UH2_0(1296, () => closure17(util.ignore(), util.ignore())); +UH2 closure17(void unitVar, void unitVar_1) => UH2_UH2_0(1296, () => closure18(util.ignore(), util.ignore())); -UH2 closure15(void unitVar, void unitVar_1) => UH2_UH2_0(216, () => closure16(util.ignore(), util.ignore())); +UH2 closure16(void unitVar, void unitVar_1) => UH2_UH2_0(216, () => closure17(util.ignore(), util.ignore())); -UH2 closure14(void unitVar, void unitVar_1) => UH2_UH2_0(36, () => closure15(util.ignore(), util.ignore())); +UH2 closure15(void unitVar, void unitVar_1) => UH2_UH2_0(36, () => closure16(util.ignore(), util.ignore())); -UH2 closure13(void unitVar, void unitVar_1) => UH2_UH2_0(6, () => closure14(util.ignore(), util.ignore())); +UH2 closure14(void unitVar, void unitVar_1) => UH2_UH2_0(6, () => closure15(util.ignore(), util.ignore())); US4 method10(int v0_1_mut, UH2 v1_1_mut) { method10: @@ -548,17 +586,17 @@ US4 method10(int v0_1_mut, UH2 v1_1_mut) { } } -US3 method9(US2 v0_1_mut, int v1_1_mut, UH1 v2_1_mut, int v3_1_mut) { +US3 method9(US0 v0_1_mut, int v1_1_mut, UH1 v2_1_mut, int v3_1_mut) { method9: while (true) { - final US2 v0_1 = v0_1_mut; + final US0 v0_1 = v0_1_mut; final v1_1 = v1_1_mut; final UH1 v2_1 = v2_1_mut; final v3_1 = v3_1_mut; if (v1_1 < 0) { final v5 = 'accumulate_dice_rolls / power: $v1_1 / acc: $v3_1'; - if (v0_1.tag == /* US2_1 */ 1) { - final v0_1_1 = v0_1 as US2_US2_1; + if (v0_1.tag == /* US0_1 */ 1) { + final v0_1_1 = v0_1 as US0_US0_1; v0_1_1.f1_0(v5); } return US3_US3_1(v3_1 + 1, v2_1); @@ -569,7 +607,7 @@ US3 method9(US2 v0_1_mut, int v1_1_mut, UH1 v2_1_mut, int v3_1_mut) { final UH1 v11 = v2_1_1.Item2; final v10 = v2_1_1.Item1; if (v10 > 1) { - final US4 v16 = method10(v1_1, UH2_UH2_0(1, () => closure13(util.ignore(), util.ignore()))); + final US4 v16 = method10(v1_1, UH2_UH2_0(1, () => closure14(util.ignore(), util.ignore()))); final tmp_combine = v10 - 1; late final int tmp_capture; if (v16.tag == /* US4_1 */ 1) { @@ -580,8 +618,8 @@ US3 method9(US2 v0_1_mut, int v1_1_mut, UH1 v2_1_mut, int v3_1_mut) { } final v23 = tmp_combine * tmp_capture; final v24 = 'accumulate_dice_rolls / power: $v1_1 / acc: $v3_1 / roll: $v10 / value: $v23'; - if (v0_1.tag == /* US2_1 */ 1) { - final v0_1_2 = v0_1 as US2_US2_1; + if (v0_1.tag == /* US0_1 */ 1) { + final v0_1_2 = v0_1 as US0_US0_1; v0_1_2.f1_0(v24); } v0_1_mut = v0_1; @@ -591,8 +629,8 @@ US3 method9(US2 v0_1_mut, int v1_1_mut, UH1 v2_1_mut, int v3_1_mut) { continue method9; } else { final v29 = 'accumulate_dice_rolls / power: $v1_1 / acc: $v3_1 / roll: $v10'; - if (v0_1.tag == /* US2_1 */ 1) { - final v0_1_3 = v0_1 as US2_US2_1; + if (v0_1.tag == /* US0_1 */ 1) { + final v0_1_3 = v0_1 as US0_US0_1; v0_1_3.f1_0(v29); } v0_1_mut = v0_1; @@ -613,10 +651,10 @@ UH1 method11(int v0_1, int Function() v1_1, int v2_1) { } } -int method12(US2 v0_1_mut, int Function() v1_1_mut, bool v2_1_mut, int v3_1_mut, int v4_1_mut, UH1 v5_mut) { +int method12(US0 v0_1_mut, int Function() v1_1_mut, bool v2_1_mut, int v3_1_mut, int v4_1_mut, UH1 v5_mut) { method12: while (true) { - final US2 v0_1 = v0_1_mut; + final US0 v0_1 = v0_1_mut; final v1_1 = v1_1_mut; final v2_1 = v2_1_mut; final v3_1 = v3_1_mut; @@ -658,10 +696,10 @@ int method12(US2 v0_1_mut, int Function() v1_1_mut, bool v2_1_mut, int v3_1_mut, } } -int method8(US2 v0_1_mut, int Function() v1_1_mut, bool v2_1_mut, int v3_1_mut, int v4_1_mut, UH1 v5_mut, int v6_mut) { +int method8(US0 v0_1_mut, int Function() v1_1_mut, bool v2_1_mut, int v3_1_mut, int v4_1_mut, UH1 v5_mut, int v6_mut) { method8: while (true) { - final US2 v0_1 = v0_1_mut; + final US0 v0_1 = v0_1_mut; final v1_1 = v1_1_mut; final v2_1 = v2_1_mut; final v3_1 = v3_1_mut; @@ -712,15 +750,15 @@ int method8(US2 v0_1_mut, int Function() v1_1_mut, bool v2_1_mut, int v3_1_mut, } } -int closure12(US2 v0_1, int Function() v1_1, bool v2_1, int v3_1) => method8(v0_1, v1_1, v2_1, v3_1, ((v3_1 == 1) ? 1 : method7(v0_1, v3_1, 0, 1)) - 1, const UH1(/* UH1_1 */ 1), 0); +int closure13(US0 v0_1, int Function() v1_1, bool v2_1, int v3_1) => method8(v0_1, v1_1, v2_1, v3_1, ((v3_1 == 1) ? 1 : method7(v0_1, v3_1, 0, 1)) - 1, const UH1(/* UH1_1 */ 1), 0); -int Function(int) closure11(US2 v0_1, int Function() v1_1, bool v2_1) => (int v) => closure12(v0_1, v1_1, v2_1, v); +int Function(int) closure12(US0 v0_1, int Function() v1_1, bool v2_1) => (int v) => closure13(v0_1, v1_1, v2_1, v); -int Function(int) Function(bool) closure10(US2 v0_1, int Function() v1_1) => (bool v) => closure11(v0_1, v1_1, v); +int Function(int) Function(bool) closure11(US0 v0_1, int Function() v1_1) => (bool v) => closure12(v0_1, v1_1, v); -int Function(int) Function(bool) Function(int Function()) closure8(void unitVar, types.Some? v0_1) { - final US2 v3_1 = option_47.defaultValue(const US2(/* US2_0 */ 0), option_47.map((void Function(String) v) => closure9(util.ignore(), v), v0_1)); - return (int Function() v_1) => closure10(v3_1, v_1); +int Function(int) Function(bool) Function(int Function()) closure10(void unitVar, types.Some? v0_1) { + final US0 v3_1 = option_47.defaultValue(const US0(/* US0_0 */ 0), option_47.map((void Function(String) v) => closure4(util.ignore(), v), v0_1)); + return (int Function() v_1) => closure11(v3_1, v_1); } int method13(UH1 v0_1_mut, int v1_1_mut) { @@ -739,8 +777,8 @@ int method13(UH1 v0_1_mut, int v1_1_mut) { } } -types.Some? closure79(types.Some? v0_1, int v1_1, UH1 v2_1) { - final US3 v10 = method9(option_47.defaultValue(const US2(/* US2_0 */ 0), option_47.map((void Function(String) v) => closure9(util.ignore(), v), v0_1)), method13(v2_1, 0) - 1, v2_1, 0); +types.Some? closure80(types.Some? v0_1, int v1_1, UH1 v2_1) { + final US3 v10 = method9(option_47.defaultValue(const US0(/* US0_0 */ 0), option_47.map((void Function(String) v) => closure4(util.ignore(), v), v0_1)), method13(v2_1, 0) - 1, v2_1, 0); late final US4 v20; if (v10.tag == /* US3_1 */ 1) { final v10_1 = v10 as US3_US3_1; @@ -757,9 +795,9 @@ types.Some? closure79(types.Some? v0_1, int v1_1, UH } } -types.Some? Function(UH1) closure78(types.Some? v0_1, int v1_1) => (UH1 v) => closure79(v0_1, v1_1, v); +types.Some? Function(UH1) closure79(types.Some? v0_1, int v1_1) => (UH1 v) => closure80(v0_1, v1_1, v); -types.Some? Function(UH1) Function(int) closure77(void unitVar, types.Some? v0_1) => (int v) => closure78(v0_1, v); +types.Some? Function(UH1) Function(int) closure78(void unitVar, types.Some? v0_1) => (int v) => closure79(v0_1, v); US5 method39(UH1 v0_1, int v1_1) { final v2_1 = 'accumulate_dice_rolls / power: ${-1} / acc: $v1_1'; @@ -1462,7 +1500,7 @@ int method14(UH1 v0_1_mut, int v1_1_mut) { } } -int closure80(void unitVar, List v0_1) { +int closure81(void unitVar, List v0_1) { final v1_1 = 'calculate_dice_count / max: ${9223372036854775807} / n: ${24} / p: ${4738381338321616896}'; console.log(v1_1); final v5 = 'result: ${method14(const UH1(/* UH1_1 */ 1), 0)}'; @@ -1474,19 +1512,19 @@ UH0 Function(UH0) v0(int v) => closure0(util.ignore(), v); UH0 Function(UH0) rotate_numbers(int x) => v0(x); -int Function() v1(UH1 v) => closure3(util.ignore(), v); +int Function() Function(UH1) v1(types.Some? v) => closure3(util.ignore(), v); -int Function() create_sequential_roller(UH1 x) => v1(x); +int Function() Function(UH1) create_sequential_roller(types.Some? x) => v1(x); -int Function(int) Function(bool) Function(int Function()) v2(types.Some? v) => closure8(util.ignore(), v); +int Function(int) Function(bool) Function(int Function()) v2(types.Some? v) => closure10(util.ignore(), v); int Function(int) Function(bool) Function(int Function()) roll_progressively(types.Some? x) => v2(x); -types.Some? Function(UH1) Function(int) v3(types.Some? v) => closure77(util.ignore(), v); +types.Some? Function(UH1) Function(int) v3(types.Some? v) => closure78(util.ignore(), v); types.Some? Function(UH1) Function(int) roll_within_bounds(types.Some? x) => v3(x); -int v4(List v) => closure80(util.ignore(), v); +int v4(List v) => closure81(util.ignore(), v); int main(List args) => v4(args); diff --git a/apps/dice/dice.dib b/apps/dice/dice.dib index 3ffe9e97..415473ee 100644 --- a/apps/dice/dice.dib +++ b/apps/dice/dice.dib @@ -209,17 +209,28 @@ listm'.init_series -1 14 1i32 #!spiral -inl create_sequential_roller list = +inl create_sequential_roller (log : option (string -> ())) list = + log |> optionm'.iter ((|>) $"$\"create_sequential_roller ()\"") inl s = list |> listm.rev |> listm.append list |> stream.from_list |> stream.memoize inl current_index = mut 0i64 inl acc = mut 1 inl len = mut -1 + inl last_item = mut None let rec loop () = + fun () => + inl current_index = *current_index + inl acc = *acc + inl len = *len + inl last_item = *last_item + log |> optionm'.iter ((|>) $"$\"create_sequential_roller / roll / current_index: {!current_index} / acc: {!acc} / len: {!len} / last_item: %A{!last_item}\"") + |> fun x => x () match s () |> stream.try_item *current_index with | Some item => current_index <- *current_index + 1 + last_item <- Some item item | None => + log |> optionm'.iter ((|>) $"$\"create_sequential_roller / roll / None\"") if *len = -1 then len <- *current_index acc <- @@ -227,6 +238,7 @@ inl create_sequential_roller list = then 1 else *acc + 1 current_index <- *acc - 1 + last_item <- None loop () loop @@ -234,10 +246,11 @@ inl create_sequential_roller list = // // test -inl sequential_roll = create_sequential_roller [ 1i32; 2; 3; 4 ] +inl sequential_roll = create_sequential_roller (Some console.write_line) [ 1i32; 2; 3; 4 ] -am.init 20i32 (ignore >> sequential_roll) -|> _equal (a ;[ 1; 2; 3; 4; 4; 3; 2; 1; 2; 3; 4; 4; 3; 2; 1; 3; 4; 4; 3; 2 ] : a i32 i32) +am.init 50i32 (ignore >> sequential_roll) +|> _equal (a ;[ 1; 2; 3; 4; 4; 3; 2; 1; 2; 3; 4; 4; 3; 2; 1; 3; 4; 4; 3; 2; 1; 4; 4; 3; 2; 1; +4; 3; 2; 1; 3; 2; 1; 2; 1; 1; 1; 2; 3; 4; 4; 3; 2; 1; 2; 3; 4; 4; 3; 2 ] : a i32 i32) #!markdown @@ -267,7 +280,7 @@ roll_progressively None roll_dice false 1 // // test -inl sequential_roll = create_sequential_roller [ 5; 4; 4; 5; 1 ] +inl sequential_roll = create_sequential_roller (Some console.write_line) [ 5; 4; 4; 5; 1 ] roll_progressively (Some console.write_line) sequential_roll false 2000i32 |> _equal 995 @@ -276,7 +289,7 @@ roll_progressively (Some console.write_line) sequential_roll false 2000i32 // // test -inl sequential_roll = create_sequential_roller [ 5; 4; 4; 5; 2 ] +inl sequential_roll = create_sequential_roller (Some console.write_line) [ 5; 4; 4; 5; 2 ] roll_progressively (Some console.write_line) sequential_roll false 2000i32 |> _equal 1678 @@ -285,7 +298,7 @@ roll_progressively (Some console.write_line) sequential_roll false 2000i32 // // test -listm'.init_series 1i32 40 1 +join dyn listm'.init_series 1i32 10000 1 |> listm.map (fun _ => roll_progressively None roll_dice false 10i32) |> listm'.group_by id |> listm.map (fun (k, v) => k, (listm.length v : i32)) @@ -298,7 +311,7 @@ listm'.init_series 1i32 40 1 // // test // // print_code=false -listm'.init_series 1i32 40 1 +join dyn listm'.init_series 1i32 10000 1 |> listm.map (fun _ => roll_progressively None roll_dice true 10i32) |> listm'.group_by id |> listm.map (fun (k, v) => k, (listm.length v : i32)) @@ -306,6 +319,21 @@ listm'.init_series 1i32 40 1 |> fun (ar : a i32 _) => $"!ar |> Array.sortBy (fun (struct (a, b)) -> a)" : a i32 $"struct (int32 * int32)" +#!spiral + +// // test +// // timeout=60000 + +join dyn listm'.init_series 1i32 100 1 +|> listm.iter fun n => + listm'.init_series 0i32 1 1 + |> listm.iter fun reroll => + join dyn listm'.init_series 1i32 3500 1 + |> listm.map fun _ => roll_progressively None roll_dice (reroll = 1) n + |> listm'.group_by id + |> listm.length + |> _equal n + #!markdown ## main @@ -321,14 +349,19 @@ inl main () = inl rotate_numbers' : i64 -> stream.stream u8 -> stream.stream u8 = rotate_numbers - inl create_sequential_roller' : (list u8 -> () -> u8) = - create_sequential_roller + inl create_sequential_roller' : + optionm'.option' (string -> ()) + -> list u8 + -> (() -> u8) + = + optionm'.unbox >> create_sequential_roller inl roll_progressively' : - (optionm'.option' (string -> ()) -> (() -> u8) + optionm'.option' (string -> ()) + -> (() -> u8) -> bool -> u64 - -> u64) + -> u64 = optionm'.unbox >> roll_progressively diff --git a/apps/dice/dice.dib.html b/apps/dice/dice.dib.html index b580fafb..9b5a6e55 100644 --- a/apps/dice/dice.dib.html +++ b/apps/dice/dice.dib.html @@ -7346,7 +7346,7 @@ if (!diagrams.length) { return; } - const mermaid = (await import("https://cdnjs.cloudflare.com/ajax/libs/mermaid/10.3.1/mermaid.esm.min.mjs")).default; + const mermaid = (await import("https://cdnjs.cloudflare.com/ajax/libs/mermaid/10.6.0/mermaid.esm.min.mjs")).default; const parser = new DOMParser(); mermaid.initialize({ @@ -7601,25 +7601,25 @@

sixth_power_sequenceaccumulate_dice_rollsaccumulate_dice_rollsaccumulate_dice_rollsroll_within_boundsroll_within_boundsroll_within_boundscalculate_dice_countcalculate_dice_countrotate_numberscreate_sequential_rollerIn [ ]: @@ -8850,11 +8949,11 @@

roll_progressively @@ -8872,7 +8971,7 @@

roll_progressively
// // test
 
-inl sequential_roll = create_sequential_roller [ 5; 4; 4; 5; 1 ]
+inl sequential_roll = create_sequential_roller (Some console.write_line) [ 5; 4; 4; 5; 1 ]
 
 roll_progressively (Some console.write_line) sequential_roll false 2000i32
 |> _equal 995
@@ -8896,12 +8995,13 @@ 

roll_progressivelyroll_progressivelyroll_progressivelyroll_progressively
// // test
 
-inl sequential_roll = create_sequential_roller [ 5; 4; 4; 5; 2 ]
+inl sequential_roll = create_sequential_roller (Some console.write_line) [ 5; 4; 4; 5; 2 ]
 
 roll_progressively (Some console.write_line) sequential_roll false 2000i32
 |> _equal 1678
@@ -9202,12 +9324,13 @@ 

roll_progressivelyroll_progressivelyroll_progressivelyroll_progressively
// // test
 
-listm'.init_series 1i32 40 1
+join dyn listm'.init_series 1i32 10000 1
 |> listm.map (fun _ => roll_progressively None roll_dice false 10i32)
 |> listm'.group_by id
 |> listm.map (fun (k, v) => k, (listm.length v : i32))
@@ -9509,7 +9655,7 @@ 

roll_progressively