-
Notifications
You must be signed in to change notification settings - Fork 1
/
bottest.h
59 lines (45 loc) · 1.05 KB
/
bottest.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#pragma once
#include "vocabulary.h"
#include "bot.h"
#include "mainHeader.h"
#include <QtCore/QObject>
#include <QtTest/QtTest>
class BotTest : public QObject
{
Q_OBJECT
public:
explicit BotTest(QObject *parent = 0);
~BotTest();
private slots:
void init()
{
bot = new Bot();
}
void setStartWord()
{
string startWord = vocabulary->getRandomStartWord();
vocabulary->add(startWord);
for (int i = 0; i < Size; i++)
field->setCell(2, i, startWord[i]);
// printField();
}
void makeStep()
{
vector <Cell> result = bot->nextTurn(3, field, vocabulary);
int xx = result.back().getX();
int yy = result.back().getY();
char ch = result.back().getCh();
//qDebug() << xx << " " << yy << " " << ch << "\n";
field->setCell(xx, yy, ch);
//cerr << field->getCell(xx, yy) << endl;
}
void cleanup()
{
delete bot;
}
private:
void printField();
Bot *bot;
Vocabulary *vocabulary;
Field *field;
};