-
Notifications
You must be signed in to change notification settings - Fork 0
/
q_learning_mode.asm
90 lines (82 loc) · 1.67 KB
/
q_learning_mode.asm
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
89
90
#include p18f87k22.inc
#include constants.inc
global qlearning_level_1, check_qlearning_level_2, check_qlearning_level_3
extern draw_player, player_x, player_y, player_gridhex
extern level1_table, level2_table, level3_table
extern mapmatrix7x7, draw_grids, gamestate
extern player_score, q_table_7x7, agent_learn
extern player_score_L, player_score_H, start
acs0 udata_acs
fsr_start res 1
q_learning_mods code
qlearning_level_1
call q_table_7x7
iter clrf player_score_L
clrf player_score_H
movlw 0x00
movwf player_score
call level1_table
call mapmatrix7x7
movlw 0x1B
movwf player_x
movwf player_y
movlw 0x08
movwf player_gridhex
call agent_learn
call draw_grids
call draw_player
movlw 0x00
cpfseq gamestate
goto iter
goto start
qlearning_level_2
call q_table_7x7
iter2 clrf player_score_L
clrf player_score_H
movlw 0x00
movwf player_score
call level2_table
call mapmatrix7x7
movlw 0x51
movwf player_x
movwf player_y
movlw 0x18
movwf player_gridhex
call agent_learn
call draw_grids
call draw_player
movlw 0x00
cpfseq gamestate
goto iter2
goto start
qlearning_level_3
call q_table_7x7
iter3 clrf player_score_L
clrf player_score_H
movlw 0x00
movwf player_score
call level3_table
call mapmatrix7x7
movlw 0x1B
movwf player_x
movwf player_y
movlw 0x08
movwf player_gridhex
call agent_learn
call draw_grids
call draw_player
movlw 0x00
cpfseq gamestate
goto iter3
goto start
check_qlearning_level_2
movlw 0x78
cpfseq gamestate
goto check_qlearning_level_3
goto qlearning_level_2
check_qlearning_level_3
movlw 0x79
cpfseq gamestate
goto start
goto qlearning_level_3
end