annotate pyikriam/example.py @ 166:f7fd2738b9b4

Move Ikariam out of __init__.py to ikariam.py.
author Thinker K.F. Li <thinker@branda.to>
date Sun, 02 Nov 2008 00:59:00 +0800
parents e49137521123
children 8f699a9da6c0
rev   line source
162
e49137521123 pyikriam retrive information about land positions.
Thinker K.F. Li <thinker@branda.to>
parents: 161
diff changeset
1 import sys
166
f7fd2738b9b4 Move Ikariam out of __init__.py to ikariam.py.
Thinker K.F. Li <thinker@branda.to>
parents: 162
diff changeset
2 from ikariam import Ikariam
62
a4c364888197 add ikriam game binding lib python version
hychen@mluna
parents:
diff changeset
3
162
e49137521123 pyikriam retrive information about land positions.
Thinker K.F. Li <thinker@branda.to>
parents: 161
diff changeset
4 if len(sys.argv) != 2:
e49137521123 pyikriam retrive information about land positions.
Thinker K.F. Li <thinker@branda.to>
parents: 161
diff changeset
5 print >> sys.stderr, 'Usage: %s <city id>' % (sys.argv[0])
e49137521123 pyikriam retrive information about land positions.
Thinker K.F. Li <thinker@branda.to>
parents: 161
diff changeset
6 sys.exit(1)
e49137521123 pyikriam retrive information about land positions.
Thinker K.F. Li <thinker@branda.to>
parents: 161
diff changeset
7 pass
e49137521123 pyikriam retrive information about land positions.
Thinker K.F. Li <thinker@branda.to>
parents: 161
diff changeset
8
e49137521123 pyikriam retrive information about land positions.
Thinker K.F. Li <thinker@branda.to>
parents: 161
diff changeset
9 city_id = int(sys.argv[1]) # 117261
e49137521123 pyikriam retrive information about land positions.
Thinker K.F. Li <thinker@branda.to>
parents: 161
diff changeset
10
64
19d2a7b175b3 Load configure data from .eagleeye.pm
kevin@localhost.localdomain
parents: 62
diff changeset
11 i = Ikariam()
162
e49137521123 pyikriam retrive information about land positions.
Thinker K.F. Li <thinker@branda.to>
parents: 161
diff changeset
12 city = i.city(city_id)
e49137521123 pyikriam retrive information about land positions.
Thinker K.F. Li <thinker@branda.to>
parents: 161
diff changeset
13
e49137521123 pyikriam retrive information about land positions.
Thinker K.F. Li <thinker@branda.to>
parents: 161
diff changeset
14 print "pull datas of the city %s" % (city_id)
62
a4c364888197 add ikriam game binding lib python version
hychen@mluna
parents:
diff changeset
15 city.sync()
162
e49137521123 pyikriam retrive information about land positions.
Thinker K.F. Li <thinker@branda.to>
parents: 161
diff changeset
16
160
7551342718b6 Refactory pyikriam with patterns.
Thinker K.F. Li <thinker@branda.to>
parents: 64
diff changeset
17 print 'gold is ' + city.gold
161
1507c2d16b35 Extract wood, marble, crystal, sulfure, and inhabitants information.
Thinker K.F. Li <thinker@branda.to>
parents: 160
diff changeset
18 print 'inhabitants is ' + city.inhabitants
1507c2d16b35 Extract wood, marble, crystal, sulfure, and inhabitants information.
Thinker K.F. Li <thinker@branda.to>
parents: 160
diff changeset
19 print 'wood is ' + city.wood
1507c2d16b35 Extract wood, marble, crystal, sulfure, and inhabitants information.
Thinker K.F. Li <thinker@branda.to>
parents: 160
diff changeset
20 print 'wine is ' + city.wine
1507c2d16b35 Extract wood, marble, crystal, sulfure, and inhabitants information.
Thinker K.F. Li <thinker@branda.to>
parents: 160
diff changeset
21 print 'marble is ' + city.marble
1507c2d16b35 Extract wood, marble, crystal, sulfure, and inhabitants information.
Thinker K.F. Li <thinker@branda.to>
parents: 160
diff changeset
22 print 'crystal is ' + city.crystal
1507c2d16b35 Extract wood, marble, crystal, sulfure, and inhabitants information.
Thinker K.F. Li <thinker@branda.to>
parents: 160
diff changeset
23 print 'sulfur is ' + city.sulfur
162
e49137521123 pyikriam retrive information about land positions.
Thinker K.F. Li <thinker@branda.to>
parents: 161
diff changeset
24 print 'positions ' + repr(city.positions)
160
7551342718b6 Refactory pyikriam with patterns.
Thinker K.F. Li <thinker@branda.to>
parents: 64
diff changeset
25