-
Notifications
You must be signed in to change notification settings - Fork 0
/
ai_config.py
39 lines (31 loc) · 963 Bytes
/
ai_config.py
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
# coding=utf-8
"""
Tetris AI: A Self-Playing Tetris
Copyright (C) 2016 Daogan Ao <https://github.com/daogan>
Date: 2016-12-27
"""
"""
AI Configurations
"""
# number of tetrominoes to look ahead during the DFS search (should be 1 or 2)
LOOK_AHEAD = 1
# milliseconds
TIMEOUT = 5
# the number of left and right blank columns of each tetromino on a 4x4 grid
LX = (0, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
RX = (2, 1, 0, 1, 2, 1, 2, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 1)
# tetromino height (r, h)
# r: index of the bottom non-blank row; h: height of the tetromino
TH = (
(2, 2),
(4, 4), (2, 1),
(2, 2), (3, 3),
(2, 2), (3, 3),
(3, 3), (3, 2), (3, 3), (2, 2),
(3, 3), (3, 2), (3, 3), (2, 2),
(3, 3), (3, 2), (3, 3), (2, 2)
)
# coefficients of the heuristic function
(A, B, C, D, E, F) = (
-4.500158825082766, 3.4181268101392694, -3.2178882868487753,
-9.348695305445199, -7.899265427351652, -3.3855972247263626)