@numerix
Please give me a test case where my code fails. I tested it with some cases and its giving write answer in IDEOne. Please help.
import sys
#import psyco
#psyco.full()
def main():
s = sys.stdin.readline
table = dict()
saver = {0:"cs", 1:"en", 2:"fr", 3:"de", 4:"hu", 5:"it", 6:"jp", 7:"pl", 8:"es"}
for i in saver:
table[saver[i]] = []
table["cs"].append("Kamen")
table["cs"].append("Nuzky")
table["cs"].append("Papir")
table["en"].append("Rock")
table["en"].append("Scissors")
table["en"].append("Paper")
table["fr"].append("Pierre")
table["fr"].append("Ciseaux")
table["fr"].append("Feuille")
table["de"].append("Stein")
table["de"].append("Schere")
table["de"].append("Papier")
table["hu"].append("Koe")
table["hu"].append("Olloo")
table["hu"].append("Papir")
table["it"].append("SassoRoccia")
table["it"].append("Forbice")
table["it"].append("CartaRete")
table["jp"].append("Guu")
table["jp"].append("Choki")
table["jp"].append("Paa")
table["pl"].append("Kamien")
table["pl"].append("Nozyce")
table["pl"].append("Papier")
table["es"].append("Piedra")
table["es"].append("Tijera")
table["es"].append("Papel")
game = 1
player1lang, player1 = s().strip().split()
player2lang, player2 = s().strip().split()
while 1:
point1 = 0
point2 = 0
try:
choice1, choice2 = s().strip().split()
while 1:
try:
player1fromtable = table[player1lang]
player2fromtable = table[player2lang]
if choice1 in player1fromtable[0] and choice2 in player2fromtable[0]:
point1, point2 = point1, point2
if choice1 in player1fromtable[1] and choice2 in player2fromtable[1]:
point1, point2 = point1, point2
if choice1 in player1fromtable[2] and choice2 in player2fromtable[2]:
point1, point2 = point1, point2
if choice1 in player1fromtable[0] and choice2 in player2fromtable[1]:
point1 +=1
if choice1 in player1fromtable[1] and choice2 in player2fromtable[0]:
point2 += 1
if choice1 in player1fromtable[1] and choice2 in player2fromtable[2]:
point1 += 1
if choice1 in player1fromtable[2] and choice2 in player2fromtable[1]:
point2 += 1
if choice1 in player1fromtable[2] and choice2 in player2fromtable[0]:
point1 += 1
if choice1 in player1fromtable[0] and choice2 in player2fromtable[2]:
point2 += 1
choice1, choice2 = s().strip().split()
except:
break
print "Game #%d:" % (game)
if point1 != 1:
print "%s: %d points" % (player1, point1)
else:
print "%s: %d point" % (player1, point1)
if point2 != 1:
print "%s: %d points" % (player2, point2)
else:
print "%s: %d point" % (player2, point2)
if point1 > point2:
print "WINNER: %s" % (player1)
if point2 > point1:
print "WINNER: %s" % (player2)
if point1 == point2:
print "TIED GAME"
game+=1
print
player1lang, player1 = s().strip().split()
player2lang, player2 = s().strip().split()
except:
return
if __name__ == '__main__':
main()