anttisalonen / freekick

Soccer game

This URL has Read+Write access

anttisalonen (author)
Fri Feb 20 03:01:48 -0800 2009
commit  a37e04c6b8ffbf85addb4f8c8e962da0f83d1f43
tree    b0ca9718552541022d7231f5e544d3f23aa936bd
parent  a8ec5200c273e7518f7bf2485965bad9beb90b24
freekick / src / freekick / match / client / python / proof_of_concept.py
100755 41 lines (32 sloc) 0.848 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/python
 
import sys
import time
 
import libfreekick_client_py as freekick
 
def main():
    conn = freekick.IP_Connection()
    conn.ip_address = "127.0.0.1"
    conn.port = "32105"
    ai = False
    network = freekick.Network(conn, ai)
    network.run(True)
    time.sleep(0.1)
    if not network.is_connected():
        print "Could not connect"
        sys.exit(1)
 
    print "waiting for input..."
    network.read_connection(True)
    print "read"
 
    m = freekick.InitialDataRequest()
    network.sendMessage(m)
    
    counter = 10
    while counter > 0:
        print "waiting for input..."
        network.read_connection(True)
        print "read"
        counter -= 1
 
    ms = network.getMatchStatus()
    print "pitch width: %d" % ms.getPitchWidth()
    time.sleep(1)
    sys.exit(0)
 
if __name__ == "__main__":
    main()