-
Notifications
You must be signed in to change notification settings - Fork 0
/
Controler.h
52 lines (44 loc) · 1.07 KB
/
Controler.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
#include "Qlearn.h"
#include <caca_conio.h>
#include <curses.h>
void play(State state){
char input; while ( input != 'q' && !isGoal(state) && !isDeadlock(state)) {
state.print_map();
switch (input) {
case 'w':
state = apply_move(state, 0);
break;
case 's':
state = apply_move(state, 1);
break;
case 'd':
state = apply_move(state, 2);
break;
case 'a':
state = apply_move(state, 3);
break;
}
input = cin.get();
}
}
void player_mode(){
cout << "\n👤 Player Mode selected. Enjoy the game!\n";
cout << "\n🎮 Controls:\n";
cout << "+-----+-------+\n";
cout << "| Key | Emoji |\n";
cout << "+-----+-------+\n";
cout << "| w | ⬆️ |\n";
cout << "| a | ⬅️ |\n";
cout << "| s | ⬇️ |\n";
cout << "| d | ➡️ |\n";
cout << "+-----+-------+\n";
init();
play(GAME);
}
void computer_mode(){
cout << "\n🤖 Computer Mode selected. Watch the AI in action!\n";
init();
Train();
printQ();
solve_game(GAME);
}