Example #1
0
    print "2. Pass              | 0"
    print "3. Spy Passive       | 30"
    print "4. Build army        | 2 each"

    if SAunlock==True: # if player has a_spys
		print "5. Spy Agressive     | 75"

    else:
        print "5. Buy Spy Agressive | 100"

    if s1[2]>0:# if the player has armies
        print "6. Attack"
    
    while action==False:        
        move1=''
        move1=getch('Selection:')
        if move1==0:
            s.close()
        s.send(move1)
        got=recieve()
        if got=='1':
            action=True
        elif got[0]=="x":
            s.send(raw_input(got[1:]))
            if recieve()=="1":
                action=True
            else:
                print "Sorry, but no"
        else:
            print "Sorry, but no"
Example #2
0
                print "Please enter a number"
            if sends>s1[2]:
                print 'You need more armies'
            elif sends>=0:
                s1[2]-=sends
                output=repr(sends)+' '+time(sends)
                print "You sent", sends,"armies."
                Valid=True
                action=True
#------------------------------------Hosting-----------
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

HOST=''
PORT=13001  

if getch("Would you like to host? (Y/N):").lower() == "y":
    s.bind((HOST,PORT))
    print ''
    print "Waiting, your computer is named",
    print socket.gethostname()
    s.listen(1)
    s,addr=s.accept()
else:
    print ''
    s.connect((raw_input("Partner's Computer Name:"),PORT))


#-----------------------------------Gameplay----------------
while s1[4]>0:#while health is over 0 
    action=False #player hasn't done anything
    spysetting=0 #type of spying is none