<commit_before>#include "greedyaiplayer.h"
#include <QTime>
#include <QDebug>

GreedyAIPlayer::GreedyAIPlayer(QObject *parent) :
    Player(parent)
{
    qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
}

void GreedyAIPlayer::doTurn()
{
    emit wantBoard();
}

bool GreedyAIPlayer::isHuman()
{
    return false;
}

void GreedyAIPlayer::getBoard(Gameboard board, int player)
{
    int max = -1;
    int old = board.points(player);
    int x = qrand()%8;
    int y = qrand()%8;
    int xstart = x;
    int ystart = y;
    int xmax = -1;
    int ymax = -1;
    Gameboard testboard;

    do
    {
        do
        {
            testboard = board;

            if(testboard.play(x,y,player))
            {
                if(testboard.points(player) > max)
                {
                    max = testboard.points(player);
                    xmax = x;
                    ymax = y;
                }
            }

            y = (y+1)%8;
        }while(y != ystart);

        x = (x+1)%8;
    }while(x != xstart);

    if(max == old)
    {
        qFatal("FATAL ERROR: GreedyAIPlayer has no turn to do!");
    }
    qDebug() << QString("Now doing %1").arg(max-old);
    if((max-old) > 6)
    {
        emit sendMessage(QString("HA! %1 points!").arg(max-old));
    }
    else
    {
        emit sendMessage(QString("OH NO! Only %1 points").arg(max-old));
    }
    emit turn(xmax, ymax);
}

void GreedyAIPlayer::humanInput(int x, int y)
{
}<commit_msg>Cleanup "greedyaiplayer.cpp"<commit_after>#include "greedyaiplayer.h"
#include <QTime>

GreedyAIPlayer::GreedyAIPlayer(QObject *parent) :
    Player(parent)
{
    qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
}

void GreedyAIPlayer::doTurn()
{
    emit wantBoard();
}

bool GreedyAIPlayer::isHuman()
{
    return false;
}

void GreedyAIPlayer::getBoard(Gameboard board, int player)
{
    int max = -1;
    int old = board.points(player);
    int x = qrand()%8;
    int y = qrand()%8;
    int xstart = x;
    int ystart = y;
    int xmax = -1;
    int ymax = -1;
    Gameboard testboard;

    do
    {
        do
        {
            testboard = board;

            if(testboard.play(x,y,player))
            {
                if(testboard.points(player) > max)
                {
                    max = testboard.points(player);
                    xmax = x;
                    ymax = y;
                }
            }

            y = (y+1)%8;
        }while(y != ystart);

        x = (x+1)%8;
    }while(x != xstart);

    if((max-old) > 6)
    {
        emit sendMessage(QString("HA! %1 points!").arg(max-old));
    }
    else
    {
        emit sendMessage(QString("OH NO! Only %1 points").arg(max-old));
    }
    emit turn(xmax, ymax);
}

void GreedyAIPlayer::humanInput(int x, int y)
{
}
{'fraction_non_alphanumeric': 0.1479739507959479, 'fraction_numerical': 0.01121562952243126, 'mean_word_length': 1.859358841778697, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5593826', 'n_tokens_mistral': 1025, 'n_tokens_neox': 989, 'n_words': 195}