From 4ad4d55fb0e64dee1b4b399f0e0ca505cff8f0fa Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Fri, 16 Sep 2022 17:34:29 +0200 Subject: Added getopt interface. --- rbmp.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/rbmp.cpp b/rbmp.cpp index c34dce4..ce057a7 100644 --- a/rbmp.cpp +++ b/rbmp.cpp @@ -112,11 +112,29 @@ public: } }; -int main() { +int main(int argc, char* argv[]) { unsigned n = 100; unsigned maxSteps = 1e8; double beliefThreshold = 1; + int opt; + + while ((opt = getopt(argc, argv, "n:m:t:")) != -1) { + switch (opt) { + case 'n': + n = atoi(optarg); + break; + case 'm': + maxSteps = (unsigned)atof(optarg); + break; + case 't': + beliefThreshold = atof(optarg); + break; + default: + exit(1); + } + } + Rng r; Graph G(n, r); -- cgit v1.2.3-70-g09d2