From ed60c0d9c743dc59533bc2c5c0564f7dbe5842d1 Mon Sep 17 00:00:00 2001 From: Simon Hickinbotham Date: Mon, 6 Apr 2020 13:02:06 +0100 Subject: [PATCH] changed some consts to constexprs for modern g++ compilers --- .gitignore | 5 +++++ include/experiments.h | 34 +++++++++++++++++----------------- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/.gitignore b/.gitignore index 0479f0a..d5fa0f2 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,8 @@ # Temporary files *~ +# The "neat" executable +neat + +# Any 'gen_' output files +gen_* diff --git a/include/experiments.h b/include/experiments.h index 67261c8..2c9b12f 100644 --- a/include/experiments.h +++ b/include/experiments.h @@ -84,23 +84,23 @@ class CartPole { bool outsideBounds(); const static int NUM_INPUTS=7; - const static double MUP = 0.000002; - const static double MUC = 0.0005; - const static double GRAVITY= -9.8; - const static double MASSCART= 1.0; - const static double MASSPOLE_1= 0.1; - - const static double LENGTH_1= 0.5; /* actually half the pole's length */ - - const static double FORCE_MAG= 10.0; - const static double TAU= 0.01; //seconds between state updates - - const static double one_degree= 0.0174532; /* 2pi/360 */ - const static double six_degrees= 0.1047192; - const static double twelve_degrees= 0.2094384; - const static double fifteen_degrees= 0.2617993; - const static double thirty_six_degrees= 0.628329; - const static double fifty_degrees= 0.87266; + constexpr static double MUP = 0.000002; + constexpr static double MUC = 0.0005; + constexpr static double GRAVITY= -9.8; + constexpr static double MASSCART= 1.0; + constexpr static double MASSPOLE_1= 0.1; + + constexpr static double LENGTH_1= 0.5; /* actually half the pole's length */ + + constexpr static double FORCE_MAG= 10.0; + constexpr static double TAU= 0.01; //seconds between state updates + + constexpr static double one_degree= 0.0174532; /* 2pi/360 */ + constexpr static double six_degrees= 0.1047192; + constexpr static double twelve_degrees= 0.2094384; + constexpr static double fifteen_degrees= 0.2617993; + constexpr static double thirty_six_degrees= 0.628329; + constexpr static double fifty_degrees= 0.87266; double LENGTH_2; double MASSPOLE_2;