From 1df83b89fd72e29c66124154bcc9bceee0a0c9af Mon Sep 17 00:00:00 2001 From: AaronGoulding Date: Sat, 1 Apr 2017 10:44:23 +0100 Subject: [PATCH 1/2] Update Predictor.py --- machineLearning/Predictor.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/machineLearning/Predictor.py b/machineLearning/Predictor.py index 0fa20c6..5968dc1 100644 --- a/machineLearning/Predictor.py +++ b/machineLearning/Predictor.py @@ -143,7 +143,10 @@ def doPredictions(enemyStrategy): result = predictTitForTat() elif enemyStrategy == "Grudger": result = predictUnforgiving() - + if result == False: + print("Opponents next move (prediction) - silence") + elif result == True: + print("Opponents next move (prediction) - betray") print(result) loadDataset('previousGames.csv', trainingSet) From 8d322fb20188e4a10625cf9a3b0f15f0c8dcdfdc Mon Sep 17 00:00:00 2001 From: AaronGoulding Date: Sat, 1 Apr 2017 11:00:53 +0100 Subject: [PATCH 2/2] Add files via upload --- machineLearning/Predictor.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/machineLearning/Predictor.py b/machineLearning/Predictor.py index 5968dc1..31df3b1 100644 --- a/machineLearning/Predictor.py +++ b/machineLearning/Predictor.py @@ -4,6 +4,7 @@ import operator # prepare data +dataFile = 'previousGames.csv' usersInput = [] enemyHistory = [] playerHistory = [] @@ -147,9 +148,8 @@ def doPredictions(enemyStrategy): print("Opponents next move (prediction) - silence") elif result == True: print("Opponents next move (prediction) - betray") - print(result) -loadDataset('previousGames.csv', trainingSet) +loadDataset(dataFile , trainingSet) print('Train set: ' + repr(len(trainingSet))) while finished == False: @@ -167,7 +167,3 @@ def doPredictions(enemyStrategy): print('>predicted player strategy = ' + playerStrategy) doPredictions(enemyStrategy) - - - -