comparison agent.pl @ 139:3bbb1e559e21

we are happy when the city level is more then 20
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Fri, 31 Oct 2008 10:11:00 +0800
parents 362184763c04
children 9fb18f3d6e26
comparison
equal deleted inserted replaced
138:454657d0308f 139:3bbb1e559e21
49 return 0; 49 return 0;
50 } 50 }
51 51
52 sub is_happiness { 52 sub is_happiness {
53 my ($self, $city) = @_; 53 my ($self, $city) = @_;
54 # TODO 以 fuzzy 取出合理 happiness 值
55
56 # we should update the travl
57 # return ($city->{growth} >= 5 ? 1 : 0)
58 # if($city->{buildings}->{townHall} <= 10);
59
60 return 0;
61
62 # FIXME. 54 # FIXME.
63 # we should update the tavern setting. 55 # we should update the tavern setting.
64 # return ($city->{happiness} >= 2 ? 1 : 0); 56
57 # we should update the travl
58 return ($city->{growth} >= 5 ? 1 : 0)
59 if($city->{buildings}->{townHall} <= 10);
60
61 return 1 if($city->{buildings}->{townHall} >= 20);
62
63 return ($city->{happiness} >= 2 ? 1 : 0);
65 } 64 }
66 65
67 sub is_warehouse_enough { 66 sub is_warehouse_enough {
68 my ($self, $city) = @_; 67 my ($self, $city) = @_;
69 # TODO 以速率計算容納率 68 # TODO 以速率計算容納率