-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscenario.py
99 lines (81 loc) · 3.2 KB
/
scenario.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
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
91
92
93
94
95
96
97
98
99
from src.game import Tetris
import src.config as config
from src.tetrominoes import Tetrominoes
import numpy as np
import random
from src.score import Score
from src.bot import RandomBot, ExpertBot, DeepBot
import time
#hate random.seed(7)
#square random.seed(1)
#left_gun random.seed(19)
#right_gun random.seed(111)
#left_snake random.seed(5)
#right_snake random.seed(12)
#long random.seed(123)
def test_scenario_one():
"""
Count number of hole in game board matrix.
In this test there is no hole
"""
random.seed(19)
tetris_game = Tetris(display=True)
bot = DeepBot(tetris=tetris_game,
model_path='artefacts/overfitter_model.hdf5',
model_architecture='simple_model',
display=True)
bot.play()
print( tetris_game.game_board_matrix[(19, 4)] == 'cyan')
print( tetris_game.game_board_matrix[(19, 5)] == 'cyan')
print( tetris_game.game_board_matrix[(19, 6)] == 'cyan')
print( tetris_game.game_board_matrix[(18, 4)] == 'cyan' )
def test_scenario_two():
"""
Count number of hole in game board matrix.
In this test there is no hole
"""
random.seed(123)
tetris_game = Tetris(display=True)
list_of_coordonates = [(19, 4), (19, 5), (19, 6), (18, 4)]
tetris_game.game_board_matrix[list_of_coordonates[0]] = "blue"
tetris_game.game_board_matrix[list_of_coordonates[1]] = "blue"
tetris_game.game_board_matrix[list_of_coordonates[2]] = "blue"
tetris_game.game_board_matrix[list_of_coordonates[3]] = "blue"
bot = DeepBot(tetris=tetris_game,
model_path='artefacts/overfitter_model.hdf5',
model_architecture='simple_model',
display=True)
bot.play()
def test_scenario_three():
"""
Count number of hole in game board matrix.
In this test there is no hole
"""
random.seed(12)
tetris_game = Tetris(display=True)
list_of_coordonates = [(19, 0), (18, 0), (19, 1), (19, 2)]
tetris_game.game_board_matrix[list_of_coordonates[0]] = "blue"
tetris_game.game_board_matrix[list_of_coordonates[1]] = "blue"
tetris_game.game_board_matrix[list_of_coordonates[2]] = "blue"
tetris_game.game_board_matrix[list_of_coordonates[3]] = "blue"
list_of_coordonates = [(19, 6), (19, 7), (19, 8), (19, 9)]
tetris_game.game_board_matrix[list_of_coordonates[0]] = "blue"
tetris_game.game_board_matrix[list_of_coordonates[1]] = "blue"
tetris_game.game_board_matrix[list_of_coordonates[2]] = "blue"
tetris_game.game_board_matrix[list_of_coordonates[3]] = "blue"
list_of_coordonates = [(19, 4), (18, 4), (19, 5), (18, 5)]
tetris_game.game_board_matrix[list_of_coordonates[0]] = "blue"
tetris_game.game_board_matrix[list_of_coordonates[1]] = "blue"
tetris_game.game_board_matrix[list_of_coordonates[2]] = "blue"
tetris_game.game_board_matrix[list_of_coordonates[3]] = "blue"
bot = DeepBot(tetris=tetris_game,
model_path='artefacts/overfitter_model.hdf5',
model_architecture='simple_model',
display=True)
bot.play()
test_scenario_one()
time.sleep(0.5)
test_scenario_two()
time.sleep(0.5)
test_scenario_three()
time.sleep(0.5)