replaced rand() with uniform_int_distribution

parent 49147a23
......@@ -20,7 +20,7 @@ IF (WIN32)
message(FATAL_ERROR "Provide your own compile flags.")
endif ()
# Make sure the build is static in Windows (just open mp is not static)
# Make sure the build is static in Windows (just openmp is not static)
if ("${CID}" STREQUAL "Clang"
OR "${CID}" STREQUAL "Intel"
OR "${CID}" STREQUAL "MSVC")
......
......@@ -4,6 +4,8 @@
#include "../gamelogic/State2x2.h"
#include "../ai/Minimax_Parallel_Deep.h"
#include <chrono>
#include <random>
#include <functional>
using namespace std::chrono;
......@@ -31,8 +33,9 @@ Search_Result calculate_action_level_master(const Game_Ptr &game) {
result.is_draw = true;
} else if ((state->moves_left > 14) ||
(!game->is_2x2() && state->moves_left == 14)) {
auto die = std::bind(std::uniform_int_distribution<>{0,9}, std::mt19937{std::random_device{}()});
result.calculated_action =
to_action(state->get_first_actions()[rand() % 10]);
to_action(state->get_first_actions()[die()]);
result.is_draw = true;
} else {
if ((game->is_2x2() && state->moves_left == 14) ||
......
......@@ -3,10 +3,9 @@
#include <FL/Fl_Menu_Bar.H>
class Menu_Bar_Modern : public Fl_Menu_Bar{
class Menu_Bar_Modern : public Fl_Menu_Bar {
public:
Menu_Bar_Modern(int X, int Y, int W, int H, const char *l);
};
#endif
......@@ -471,8 +471,7 @@ void cb_menu_redo(Fl_Widget *, void *){
}
int main() {
if(!is_ssse3_supported()){
if (!is_ssse3_supported()) {
int place_x = Fl::w() / 2 - 300 / 2;
int place_y = Fl::h() / 2 - 100 / 2;
Fl_Window *window = new Fl_Window(place_x, place_y, 300, 100);
......
......@@ -26,7 +26,7 @@ template <typename T, uint64_t N> struct StringMaker<std::array<T, N>> {
*
* one action consists of two parts:
* - placing a the piece that was chosen from the opponent
* - choosing the a piece for the oponent
* - choosing the a piece for the opponent
*
* Action(index on board to place the piece, index to chose a piece for the
* opponent)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment