diff 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
line wrap: on
line diff
--- a/agent.pl	Fri Oct 31 02:21:49 2008 +0800
+++ b/agent.pl	Fri Oct 31 10:11:00 2008 +0800
@@ -51,17 +51,16 @@
 
 sub is_happiness {
     my ($self, $city) = @_;
-    # TODO 以 fuzzy 取出合理 happiness 值
+    # FIXME.
+    # we should update the tavern setting.
 
     # we should update the travl
-    # return ($city->{growth} >= 5 ?  1 : 0) 
-    #    if($city->{buildings}->{townHall} <= 10);
+    return ($city->{growth} >= 5 ?  1 : 0) 
+        if($city->{buildings}->{townHall} <= 10);
 
-    return 0;
+    return 1 if($city->{buildings}->{townHall} >= 20);
  
-    # FIXME.
-    # we should update the tavern setting.
-    # return ($city->{happiness} >= 2 ?  1 : 0);
+    return ($city->{happiness} >= 2 ?  1 : 0);
 }
 
 sub is_warehouse_enough {