diff options
author | RossTheRoss <msattr@gmail.com> | 2019-02-23 17:43:17 -0600 |
---|---|---|
committer | RossTheRoss <msattr@gmail.com> | 2019-02-23 17:43:17 -0600 |
commit | a65262693b1971be22030d599f9c09959be65fe8 (patch) | |
tree | 9b2f5f1eb7e7c7230200926066113b53cd400290 /ee1301 | |
parent | Start HW 3 (diff) | |
download | homework-a65262693b1971be22030d599f9c09959be65fe8.tar homework-a65262693b1971be22030d599f9c09959be65fe8.tar.gz homework-a65262693b1971be22030d599f9c09959be65fe8.tar.bz2 homework-a65262693b1971be22030d599f9c09959be65fe8.tar.lz homework-a65262693b1971be22030d599f9c09959be65fe8.tar.xz homework-a65262693b1971be22030d599f9c09959be65fe8.tar.zst homework-a65262693b1971be22030d599f9c09959be65fe8.zip |
Fix dumb mistakes
Diffstat (limited to 'ee1301')
-rw-r--r-- | ee1301/wk3/hw3_directory/strap012_HW3A.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/ee1301/wk3/hw3_directory/strap012_HW3A.cpp b/ee1301/wk3/hw3_directory/strap012_HW3A.cpp index ce44428..7e1cfbb 100644 --- a/ee1301/wk3/hw3_directory/strap012_HW3A.cpp +++ b/ee1301/wk3/hw3_directory/strap012_HW3A.cpp @@ -15,7 +15,7 @@ One-armed Bandit Simulator using namespace std; int spin_the_wheel(int d, int w) { int spinOG, spinNew; - spinOG = rand() % d + 1 + spinOG = rand() % d + 1; for (int i=w; i>0; i--) { spinNew = rand() % d + 1 if (spinNew==spingOG) { @@ -27,13 +27,13 @@ int spin_the_wheel(int d, int w) { return 1; } int main () { - int win; + int m; int d= 3; int w= 9; for (long n=1000000; n>0; n--) { - win = spin_the_wheel(d,w); - if (win==1) { - win++; + m = spin_the_wheel(d,w); + if (m==1) { + m++; } } cout << "w=" << w << ", d=" << d; |