dotboxEngine/randomplayer.cxx
2024-11-20 02:44:18 +00:00

18 lines
355 B
C++

//
// Created by pranshav on 11/18/24.
//
#include "randomplayer.h"
point RandomPlayer::randomMove(Points& points) {
int size = points.getSize();
if (size != 0) {
srand(time(0));
int randomIndex = rand()%size;
point temp = points.array[randomIndex];
points.removeIndex(randomIndex);
return temp;
}
}