Commit c4e3660c authored by Frederik Schwarzer's avatar Frederik Schwarzer

Use C++ time instead of C time.

parent b4bc132a
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include "aiboard.h" #include "aiboard.h"
#include <time.h> #include <ctime>
#include <vector> #include <vector>
#include <iostream> #include <iostream>
...@@ -81,7 +81,7 @@ usi AiBoard::height() const { ...@@ -81,7 +81,7 @@ usi AiBoard::height() const {
Coord AiBoard::move() { Coord AiBoard::move() {
if (m_cleanBoard) { if (m_cleanBoard) {
qsrand(static_cast<int>(time(0))); qsrand(static_cast<int>(std::time(nullptr)));
usi randX = qrand()%(m_dimension->width()/3) + m_dimension->width()/3; usi randX = qrand()%(m_dimension->width()/3) + m_dimension->width()/3;
usi randY = qrand()%(m_dimension->height()/3) + m_dimension->height()/3; usi randY = qrand()%(m_dimension->height()/3) + m_dimension->height()/3;
return Coord(randX, randY); return Coord(randX, randY);
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include <cstdlib> #include <cstdlib>
#include <memory.h> #include <memory.h>
#include <assert.h> #include <assert.h>
#include <time.h> #include <ctime>
#include <stdio.h> #include <stdio.h>
// hash table // hash table
...@@ -45,7 +45,7 @@ AiImpl::AiImpl() : table_size_x(20), table_size_y(20), ...@@ -45,7 +45,7 @@ AiImpl::AiImpl() : table_size_x(20), table_size_y(20),
{ {
if (!rand_inited) { if (!rand_inited) {
rand_inited = true; rand_inited = true;
qsrand((unsigned int) time(NULL)); qsrand(static_cast<unsigned int>(std::time(nullptr)));
} }
memset(hashData, 0, sizeof(hashData)); memset(hashData, 0, sizeof(hashData));
} }
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#include "standing.h" #include "standing.h"
#include <assert.h> #include <assert.h>
#include <time.h>
Node::Node(Standing* _standing, AiImpl* ai): Node::Node(Standing* _standing, AiImpl* ai):
standing(_standing), standing(_standing),
......
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