|
@ -51,40 +51,37 @@ else: |
|
|
powerPhrases = [] |
|
|
powerPhrases = [] |
|
|
|
|
|
|
|
|
for phrase in phrases: |
|
|
for phrase in phrases: |
|
|
phrase = phrase.lower() |
|
|
|
|
|
if phrase != "\n" and phrase[0] != '#': |
|
|
if phrase != "\n" and phrase[0] != '#': |
|
|
|
|
|
phrase = phrase.lower()[:-1] |
|
|
found = False |
|
|
found = False |
|
|
for serverResult in serverResults: |
|
|
for serverResult in serverResults: |
|
|
if serverResult['solution'].encode('ascii','replace') == phrase[:-1]: |
|
|
|
|
|
|
|
|
if serverResult['solution'].encode('ascii','replace') == phrase : |
|
|
found = True |
|
|
found = True |
|
|
if serverResult['powerScore'] > 0: |
|
|
if serverResult['powerScore'] > 0: |
|
|
print "Eureka! %s powerScore: %s score: %s"%(phrase[:-1], serverResult['powerScore'], serverResult['score']) |
|
|
|
|
|
powerPhrases.append(phrase[:-1]) |
|
|
|
|
|
|
|
|
print "Eureka! %s powerScore: %s score: %s"%(phrase , serverResult['powerScore'], serverResult['score']) |
|
|
|
|
|
powerPhrases.append(phrase ) |
|
|
break |
|
|
break |
|
|
elif serverResult['powerScore'] is None: |
|
|
elif serverResult['powerScore'] is None: |
|
|
print " Evaluation pending on %s"%phrase[:-1] |
|
|
|
|
|
break |
|
|
|
|
|
else: |
|
|
|
|
|
#print "No powerScore on %s"%phrase[:-1] |
|
|
|
|
|
|
|
|
print " Evaluation pending on %s"%phrase |
|
|
break |
|
|
break |
|
|
if found: |
|
|
if found: |
|
|
continue |
|
|
continue |
|
|
for i in range (0, 25): |
|
|
for i in range (0, 25): |
|
|
process = subprocess.Popen(['src/TestSolution -f sample_problems/problem_'+str(i)+'.json -n 0 -p ' + stringToCommandSequence(phrase[:-1])], shell = True, stdout=subprocess.PIPE) |
|
|
|
|
|
|
|
|
process = subprocess.Popen(['src/TestSolution -f sample_problems/problem_'+str(i)+'.json -n 0 -p ' + stringToCommandSequence(phrase )], shell = True, stdout=subprocess.PIPE) |
|
|
out, err = process.communicate() |
|
|
out, err = process.communicate() |
|
|
if err == None and out.find("Error") == -1 and out.find("Irrefutable") == -1: |
|
|
if err == None and out.find("Error") == -1 and out.find("Irrefutable") == -1: |
|
|
break |
|
|
break |
|
|
if err == None and out.find("Error") == -1 and out.find("Irrefutable") == -1: |
|
|
if err == None and out.find("Error") == -1 and out.find("Irrefutable") == -1: |
|
|
OUTPUT=('[{"seed":0,"tag":"shapeShifter","solution":"%s","problemId":12}]'%phrase[:-1]).replace('"', "\\\"") |
|
|
|
|
|
|
|
|
OUTPUT=('[{"seed":0,"tag":"shapeShifter","solution":"%s","problemId":12}]'%phrase ).replace('"', "\\\"") |
|
|
process = subprocess.Popen(['curl --user :2aaFCkjNIDHAsAIh9iQHc+Y+FGhkM5Z0RQgpO6TL6EA= -X POST -H "Content-Type: application/json" -d "' + OUTPUT + '" https://davar.icfpcontest.org/teams/235/solutions'], shell = True, stdout=subprocess.PIPE) |
|
|
process = subprocess.Popen(['curl --user :2aaFCkjNIDHAsAIh9iQHc+Y+FGhkM5Z0RQgpO6TL6EA= -X POST -H "Content-Type: application/json" -d "' + OUTPUT + '" https://davar.icfpcontest.org/teams/235/solutions'], shell = True, stdout=subprocess.PIPE) |
|
|
out, err = process.communicate() |
|
|
out, err = process.communicate() |
|
|
if err == None and out == "created": |
|
|
if err == None and out == "created": |
|
|
print "%s sended"%phrase[:-1] |
|
|
|
|
|
|
|
|
print "%s sended"%phrase |
|
|
else: |
|
|
else: |
|
|
print out |
|
|
print out |
|
|
print " %s unable to comunicate with server"%phrase[:-1] |
|
|
|
|
|
|
|
|
print " %s unable to comunicate with server"%phrase |
|
|
else: |
|
|
else: |
|
|
print " %s return error"%phrase[:-1] |
|
|
|
|
|
|
|
|
print " %s return error"%phrase |
|
|
print "\n%d power phrases found:"%len(powerPhrases) |
|
|
print "\n%d power phrases found:"%len(powerPhrases) |
|
|
for powerPhrase in powerPhrases: |
|
|
for powerPhrase in powerPhrases: |
|
|
print powerPhrase |
|
|
print powerPhrase |
|
|