Skip to content

Commit

Permalink
Fixed the error with the Statistics
Browse files Browse the repository at this point in the history
Fixed error with statistics, Maybe even fixed one with the movemaker, not so sure about that xD
  • Loading branch information
the-cybersapien committed Apr 27, 2017
1 parent a38a861 commit 6421e3e
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 13 deletions.
4 changes: 2 additions & 2 deletions SciKit-Play-GUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ def combo_chosen_2(self):
print (c1, c2, c3, c4)

def statistic(self):
url_1 = QtCore.QUrl('utilities\stat_1.pyw')
QtGui.QDesktopServices.openUrl(url_1)
import stat_1
stat_1.calstat()

def combo_chosen_3(self):
self.v1.clear()
Expand Down
4 changes: 4 additions & 0 deletions driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ def __init__(self, board_coords):

self.mover = move_maker.MoveMaker()

fx = open('movefile.txt', "w+")
fx.write('')
fx.close()


def close_script(self):
print 'wow'
Expand Down
22 changes: 12 additions & 10 deletions move_maker.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
from copy import deepcopy as dc
import utils


# import prev

class MoveMaker:
def __init__(self):
self.board_size = utils.board_size
Expand Down Expand Up @@ -182,8 +179,17 @@ def check_direction(self, start, dir):
else:
return score_end, [end, start]

# main function to start solving the board

# function to maintain stats in file
def addStat(self, move):
filex = open('movefile.txt', 'a')
if move[0][0] == move[1][0]:
filex.write('1\n')
else:
filex.write('0\n')
filex.close()

# main function to start solving the board
def solve_board(self, board):
self.game_board = board
filem = open('flag.txt', 'r+')
Expand All @@ -210,17 +216,11 @@ def solve_board(self, board):
filew.close()
x = [(0, 0), (0, 0)]
return x
#solve_board(board)
else:
file = open('prev.txt', 'w+')
file.write(repr(chosen_move))
file.close()
print ("I am awesome", chosen_move)
'''if(chosen_move[0][0] == chosen_move[1][0]):
print 1
else:
print 0'''
return chosen_move

filex = open('prev.txt', 'r+')
previous_move = filex.read()
Expand All @@ -240,6 +240,8 @@ def solve_board(self, board):
print 1
else:
print 0'''
self.addStat(chosen_move)

return chosen_move


Expand Down
1 change: 1 addition & 0 deletions stat_1.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

def calstat():
import matplotlib
import utils

matplotlib.use('Qt4Agg')
from matplotlib import pyplot as plt
Expand Down
5 changes: 4 additions & 1 deletion utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,7 @@ def print_board(board):
scoreboard = 105
shop = 106

back_recognizer = 'back.dat'
back_recognizer = 'back.dat'

horizontal_move = '0'
vertical_move = '1'

0 comments on commit 6421e3e

Please sign in to comment.