#!/usr/local/bin/python
# -*- coding: UTF-8 -*-

import Cookie
import cgi
import cgitb; cgitb.enable()  # for troubleshooting
import Player
import os

thecookie = os.environ.get('HTTP_COOKIE')
C = Cookie.SimpleCookie()
C.load(thecookie)
p11 = C["username"].value
p22 = C["enemy"].value
p33 = C["field"].value
toWrite = open("%s.txt"%(p33), "w")

p1 = Player.Player("0",2)
p2 = Player.Player("0",2)


toWrite.write("%s\n%s|%s|%s\n%s|%s|%s"%(p11,p11,p1.position,p1.score,p22,p2.position,p2.score))
toWrite.close()

print 'Location: http://students.washington.edu/zbadgerm/Math480/setships.cgi\n'