annotate pyikriam/example.py @ 173:e8a244ce5a1d

update the tavern setting
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Sun, 02 Nov 2008 04:12:00 +0800
parents e49137521123
children f7fd2738b9b4
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
62
a4c364888197 add ikriam game binding lib python version
hychen@mluna
parents:
diff changeset
2 from __init__ import Ikariam
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