comparison inference.pl @ 52:d2ac1e198ce4

implement a new agent based on Decision Tree (Decision::ParseTree)
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Mon, 20 Oct 2008 19:07:53 +0800
parents 5849b6fdc76c
children
comparison
equal deleted inserted replaced
51:bc31729f29f4 52:d2ac1e198ce4
10 { 10 {
11 my ($city, $msg) = @_; 11 my ($city, $msg) = @_;
12 printf("http://%s/index.php?view=city&id=%s (%s) %s \n", 12 printf("http://%s/index.php?view=city&id=%s (%s) %s \n",
13 $::server, $city, $cities->{$city}->{name}, $msg); 13 $::server, $city, $cities->{$city}->{name}, $msg);
14 } 14 }
15
16 our $i = new Ikariam($::server, $::user, $::pass);
17 $i->login;
18 $cities = $i->check;
19 $i->logout;
20 15
21 sub rule_happiness 16 sub rule_happiness
22 { 17 {
23 my $id = shift; 18 my $id = shift;
24 19
109 print("\n"); 104 print("\n");
110 } 105 }
111 print("\n"); 106 print("\n");
112 } 107 }
113 108
109 our $i = new Ikariam($::server, $::user, $::pass);
110 $i->login;
111 $cities = $i->check;
112 $i->logout;
113
114 # space 114 # space
115 # Checking rules 115 # Checking rules
116 foreach my $procedure (qw/rule_war rule_happiness rule_corruption rule_building rule_space rule_resource/) { 116 foreach my $procedure (qw/rule_war rule_happiness rule_corruption rule_building rule_space rule_resource/) {
117 foreach my $id (keys(%$cities)) { 117 foreach my $id (keys(%$cities)) {
118 eval(sprintf("%s(%s);", $procedure, $id)); 118 eval(sprintf("%s(%s);", $procedure, $id));