summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2022-09-16 17:34:29 +0200
committerJaron Kent-Dobias <jaron@kent-dobias.com>2022-09-16 17:34:29 +0200
commit4ad4d55fb0e64dee1b4b399f0e0ca505cff8f0fa (patch)
tree6cdb76dba2626a8bd07b9f51517aab83100f6367
parent2d833ad2bf32632a2230ce1ebe28dc8207898ad7 (diff)
downloadcode-4ad4d55fb0e64dee1b4b399f0e0ca505cff8f0fa.tar.gz
code-4ad4d55fb0e64dee1b4b399f0e0ca505cff8f0fa.tar.bz2
code-4ad4d55fb0e64dee1b4b399f0e0ca505cff8f0fa.zip
Added getopt interface.
-rw-r--r--rbmp.cpp20
1 files changed, 19 insertions, 1 deletions
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);