-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbackTest.py
More file actions
26 lines (21 loc) · 865 Bytes
/
backTest.py
File metadata and controls
26 lines (21 loc) · 865 Bytes
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
import pandas as pd
import os.path
from crawlerBot import playGame
CURRENT_GAME = 162
PATH_TO_DATAFRAME = 'C:/Users/arnon/Documents/IME/ContextoBot/records.csv'
COLUMNS_NAMES = ['gameNumber', 'numberTentatives', 'totalTime', 'correctWord']
MAX_TENTATIVES = 1000
def main():
recordsExists = os.path.exists(PATH_TO_DATAFRAME)
records = pd.DataFrame()
if recordsExists:
records = pd.read_csv('records.csv')
else:
records = pd.DataFrame(columns=COLUMNS_NAMES)
for gameNumber in range(len(records) + 1, CURRENT_GAME + 1):
gameInfo = playGame(gameNumber, MAX_TENTATIVES)
record = pd.DataFrame([(gameInfo.gameNumber, gameInfo.numberTentatives, gameInfo.totalTime, gameInfo.correctWord)], columns = COLUMNS_NAMES)
records = pd.concat([records, record])
records.to_csv('records.csv', index = False)
if __name__ == "__main__":
main()