Skip to content

Commit

Permalink
Changed gesture constants to 0-2
Browse files Browse the repository at this point in the history
  • Loading branch information
DrGFreeman committed Feb 9, 2018
1 parent 1906e3d commit 748fc71
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions play.py
Expand Up @@ -70,7 +70,7 @@ def saveImage(img, gesture, notify=False):
print("Press ESC or q to quit\n")

# Initialize last gesture value
lastGesture = 0
lastGesture = -1

# Initialize player scores
playerScore = 0
Expand Down Expand Up @@ -120,7 +120,7 @@ def saveImage(img, gesture, notify=False):
gesture = predGesture

# Computer gesture
computerGesture = random.randint(1,3)
computerGesture = random.randint(0,2)
print('Computer: {}'.format(rps.gestureTxt[computerGesture]))

diff = computerGesture - predGesture
Expand All @@ -139,7 +139,7 @@ def saveImage(img, gesture, notify=False):

else:

lastGesture = 0
lastGesture = -1

# Rotate and add framerate to copy of image
imgFR = imp.fastRotate(img)
Expand Down
6 changes: 3 additions & 3 deletions playgui.py
Expand Up @@ -87,7 +87,7 @@ def saveImage(img, gesture, notify=False):
cam = rps.cameraSetup()

# Initialize last gesture value
lastGesture = 0
lastGesture = -1

# Define score at which game ends
endScore = 5
Expand Down Expand Up @@ -150,7 +150,7 @@ def saveImage(img, gesture, notify=False):
gesture = predGesture

# Computer gesture
computerGesture = random.randint(1,3)
computerGesture = random.randint(0,2)
print('Computer: {}'.format(rps.gestureTxt[computerGesture]))

# Set computer image to computer gesture
Expand All @@ -173,7 +173,7 @@ def saveImage(img, gesture, notify=False):

else:

lastGesture = 0
lastGesture = -1

# Set computer image to green
gui.setCoImg(greenImg)
Expand Down
6 changes: 3 additions & 3 deletions rpsutil.py
Expand Up @@ -34,9 +34,9 @@
#import camera

# Define possible gestures as constants
ROCK = 1
PAPER = 2
SCISSORS = 3
ROCK = 0
PAPER = 1
SCISSORS = 2

# Define text labels corresponding to gestures
gestureTxt = {ROCK: 'rock', PAPER: 'paper', SCISSORS: 'scissors'}
Expand Down
2 changes: 1 addition & 1 deletion train.py
Expand Up @@ -48,7 +48,7 @@
#clf__C = np.logspace(0, 1, 3)
clf__C = np.logspace(0, 2, 5)
scoring = 'f1_micro'
n_jobs = 4
n_jobs = -1


def train(nbImg=0, cvScore=False):
Expand Down

0 comments on commit 748fc71

Please sign in to comment.