diff --git a/Bamboo.sdf b/Bamboo.sdf index c393e44..e747a7c 100644 Binary files a/Bamboo.sdf and b/Bamboo.sdf differ diff --git a/BambooStick.cpp b/BambooStick.cpp index 1183c6a..e073a65 100644 --- a/BambooStick.cpp +++ b/BambooStick.cpp @@ -37,7 +37,16 @@ void BambooStick::render() { } void BambooStick::generate() { - int segmentsNo = rand() % 5 + 3; + int segmentsNo; + std::default_random_engine generator; + std::normal_distribution distribution(2.0, 0.75); + + float number = distribution(generator); + if ((number >= 0.0) && (number < 4.0)) + segmentsNo = (int)number + 3; + else + segmentsNo = 5; + for (int i = 0; i < segmentsNo; i++) segments->push_back(generateSegment()); } diff --git a/Debug/Bamboo.tlog/CL.read.1.tlog b/Debug/Bamboo.tlog/CL.read.1.tlog index 786a7b7..08739f9 100644 Binary files a/Debug/Bamboo.tlog/CL.read.1.tlog and b/Debug/Bamboo.tlog/CL.read.1.tlog differ diff --git a/Debug/Bamboo.tlog/cl.write.1.tlog b/Debug/Bamboo.tlog/cl.write.1.tlog index 2a550e1..93b47cb 100644 Binary files a/Debug/Bamboo.tlog/cl.write.1.tlog and b/Debug/Bamboo.tlog/cl.write.1.tlog differ diff --git a/Debug/Bamboo.tlog/link.read.1.tlog b/Debug/Bamboo.tlog/link.read.1.tlog index fb3160e..81eb5a6 100644 Binary files a/Debug/Bamboo.tlog/link.read.1.tlog and b/Debug/Bamboo.tlog/link.read.1.tlog differ diff --git a/Debug/vc120.idb b/Debug/vc120.idb index 0e2892c..140fd0e 100644 Binary files a/Debug/vc120.idb and b/Debug/vc120.idb differ diff --git a/Entity.h b/Entity.h index ff48ff6..0421043 100644 --- a/Entity.h +++ b/Entity.h @@ -5,6 +5,7 @@ #include /* srand, rand */ #include /* time */ #include +#include class Entity { protected: diff --git a/gkom.cpp b/gkom.cpp index dfc1314..ec5a199 100644 --- a/gkom.cpp +++ b/gkom.cpp @@ -11,6 +11,7 @@ #include "Floor.h" #include "Camera.h" #include "Map.h" +#include int width; int height; @@ -132,6 +133,27 @@ int main(int argc, char** argv) { init(); glutMainLoop(); + //const int nrolls = 10000; // number of experiments + //const int nstars = 100; // maximum number of stars to distribute + + //std::default_random_engine generator; + //std::normal_distribution distribution(2.0, 0.7); + + //int p[10] = {}; + + //for (int i = 0; i= 0.0) && (number<10.0)) ++p[int(number)]; + //} + + //std::cout << "normal_distribution (5.0,2.0):" << std::endl; + + //for (int i = 0; i<10; ++i) { + // std::cout << i << "-" << (i + 1) << ": "; + // std::cout << std::string(p[i] * nstars / nrolls, '*') << std::endl; + //} + // + //std::cin.get(); return 0; }