Hi
I am building a web application of MasterMind using starter code. I have been able to allow the player to input guesses but I am having issues comparing the user guess to the colors generated by the game. If someone could please explain how to do this that would be great. Iam launching this with app engine. I attached my starter code and controller.

Thanks


STARTER CODE


# mastermind game, command line edition

import random
def generateSecret(colors):
secret=[]
i=0
while i<4:
number= random.randint(0,len(colors)-1)
color = colors[number]
secret.append(color)
i=i+1
return secret


def computeExacts(guess,secretCopy):
i=0
match=0
while (i<4):
if (guess[i]==secretCopy[i]):
match=match+1
# cross out so doesn't match again
guess[i]='x'
secretCopy[i]='y'
i=i+1
return match

def computePartials(guess,secretCopy):
i=0
partial_matches=0
while (i<4):
j=0
while (j<4):
if (guess[i]==secretCopy[j]):
partial_matches=partial_matches+1
# cross out so doesn't match again
guess[i]='x'
secretCopy[j]='y'
j=j+1
i=i+1
return partial_matches



CONTROLLER



import cgi
import os
from google.appengine.ext.webapp import template
from google.appengine.ext import db
from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app

from appengine_utilities import sessions

import mastermind
# main page appears on load
class MainPage(webapp.RequestHandler):
def get(self):
session = sessions.Session()
colors=["red","blue","green","purple","yellow","brown"]
session['secret']=mastermind.generateSecret(colors)
template_values={'secret':session['secret']}
# render the page using the template engine
path = os.path.join(os.path.dirname(__file__),'index.html ')
self.response.out.write(template.render(path,templ ate_values))

class GuessHandler(webapp.RequestHandler):
def get(self):
session=sessions.Session()
color1=str(self.request.get('color1'))
color2=str(self.request.get('color2'))
color3=str(self.request.get('color3'))
color4=str(self.request.get('color4'))
guess=[]
guess.append(color1)
guess.append(color2)
guess.append(color3)
guess.append(color4)
exacts = mastermind.computeExacts(guess,secretCopy)
exacts = mastermind.computeExacts(guess,secretCopy)
exacts = mastermind.computeExacts(guess,secretCopy)
exacts = mastermind.computeExacts(guess,secretCopy)
# set up the template_values with the list of people returned.
template_values= {'guess':guess, 'secret':session['secret']}
# render the page using the template engine
path = os.path.join(os.path.dirname(__file__),'index.html ')
self.response.out.write(template.render(path,templ ate_values))


# create this global variable that represents the application and specifies which class
# should handle each page in the site
application = webapp.WSGIApplication(
# MainPage handles the home load
[('/', MainPage),
# when user clicks on add button, we call on_add action
# check out index.html to see where on_add gets submitted
('/on_guess', GuessHandler)],
debug=True)

def main():
run_wsgi_app(application)

if __name__ == "__main__":
main()