-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_AkinatorDialog.cpp
More file actions
executable file
·89 lines (73 loc) · 2.35 KB
/
test_AkinatorDialog.cpp
File metadata and controls
executable file
·89 lines (73 loc) · 2.35 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#include "CAkinator.h"
/***************************************************************************//**
* \file test_AkinatorDialog.cpp
*
* \brief Some tests for the class AkinatorDialog
*
* \author Arnaud Ramey ( arnaud.ramey@m4x.org )
*
* \date 19/06/2009
*******************************************************************************/
#include <string.h> // for strlen
void test_solver() {
string rep;
int rep_type;
int player_choice;
AkinatorDialog ak;
ak.DEBUG = 1;
// ak.ping();
// return;
ak.start_game();
while (ak.game_status == GAME_STATUS_RUNNING) {
ak.find_next_move();
if (ak.game_status == GAME_STATUS_LOST_BY_AKINATOR)
break;
ak.get_answer(&rep_type, &rep);
if (rep_type == ANSWER_TYPE_ERROR_WRONG_ARGUMENT)
break;
else if (rep_type == ANSWER_TYPE_ERROR_WEBSITE_FAILURE)
break;
else if (rep_type == ANSWER_TYPE_NEW_QUESTION) {
cout << endl << endl << "Question:" << rep << endl;
cout << "INPUT_TYPE_YES:" << INPUT_TYPE_YES << endl;
cout << "INPUT_TYPE_PROBABLY:" << INPUT_TYPE_PROBABLY << endl;
cout << "INPUT_TYPE_DO_NOT_KNOW:" << INPUT_TYPE_DO_NOT_KNOW << endl;
cout << "INPUT_TYPE_PROBABLY_NOT:" << INPUT_TYPE_PROBABLY_NOT
<< endl;
cout << "INPUT_TYPE_NO:" << INPUT_TYPE_NO << endl;
cout << "Answer?";
cin >> player_choice;
ak.send_player_answer(player_choice);
}
else if (rep_type == ANSWER_TYPE_SUGGESTION) {
cout << endl << endl << "Suggestion:" << rep << endl;
cout << "INPUT_TYPE_PEOPLE_YES:" << INPUT_TYPE_PEOPLE_YES << endl;
cout << "INPUT_TYPE_PEOPLE_NO:" << INPUT_TYPE_PEOPLE_NO << endl;
cout << "Answer?";
cin >> player_choice;
ak.send_player_answer(player_choice);
}
} // end of while loop
}
void test_skill() {
#if IN_VISMAGGIE
//CettsSkill* ettsSkill = new CettsSkill(0);
CettsSkillWrapper etts; //skill wrapper para poder usar la habilidad de manera sencilla sin preocuparnos de escribir en MCP
etts.activaEttsSkill(); //emite el evento que activa la habilidad
#endif
CAkinator* ak = new CAkinator(100);
ak->launch();
while (1) {
char line[10];
std::cin.getline(line, 10);
if (strlen(line) < 1) // user entered empty line -> quit
break;
}
ak->end();
delete ak;
}
int main() {
test_solver();
//test_string();
// test_skill();
}