18 lines
355 B
C++
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;
|
|
}
|
|
|
|
}
|